仿58同城UITableViewCell動畫

2021-09-23 21:54:07 字數 1452 閱讀 1405

在做的過程中也遇到了幾個小的問題,也算是注意點吧。

1.cell出現時每個cell的動畫時間一樣,導致沒有依次移動的效果。

根據indexpath來設定cell動畫時間,擔心時間增大時最後面的cell會出現的很慢,想著讓indexpath%20這樣來解決,但決定效果不太理想, 所以就還是直接用indexpath來設定動畫時間

之前以為cell的父檢視不是tableview(具體是什麼我也不清楚),設定cell動畫時將cell的y設為0了,這就導致上面的問題,應該根據indexpath和每個rowheight來計算y的位置。

3.cell再次出現時也會有動畫,向上滑動時最上面的先出來,稍下面的後出來

想著讓cell動畫只執行一次這樣就不會導致cell動畫混亂。

4.**

//

// viewcontroller.m

// tableviewcell

//// created by city--online on 15/11/9.

//#import "viewcontroller.h"

@inte***ce viewcontroller ()@property (nonatomic,strong) uitableview *tableview;

@property (nonatomic,strong) nsmutablearray *showedindexpaths;

@end

@implementation viewcontroller

- (void)viewdidload

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

- (void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath

else];}

}- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath

- (void)didreceivememorywarning

@end

5.效果

58同城演算法

58同城題目 58同城出了三道演算法題,第一道題題目過長。好像是和推薦系統掛鉤的題目 給cv一條活路吧!t t 第二道題還有第三道題都是leetcode上很簡單的題目 第一次2ac!主要還是題目簡單 主要想說一下第二道題目,給定乙個非負整數num,求在0 x num區間中的所有整數的二進位制數中1的...

python 爬蟲 58同城

from bs4 import beautifulsoup import requests import csv import time url 已完成的頁數序號,初時為0 page 0 建立乙個有寫許可權的csv file csv file open rent.csv w 建立csv writer...

58 同城面試總結

就是去玩的,該帶的東西都沒帶。一面 先自我介紹,然後說了下專案。一上來和我扯c 記憶體管理,都尼瑪說了遇到過類似的東西還尼瑪問,多虧我機智趕緊開啟話題。然後 兩個演算法題。1.給出乙個陣列有乙個數字出現1次其他的數字出現了3次找出這個出現一次的數字。sl 搞下位運算mod3就好 2.給出乙個數字的字...