我正在尝试使用 uiclloectionview 创建周日历。这是视图聚焦时的样子:
当我滚动到底部并滚动回顶部时的原始视图。由于滚动更改文本而消失的那些单元格。 滚动视图
这是我的代码:
@interface ViewController ()
@end
@implementation ViewController
@synthesize calendar;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//[self.calendar setCollectionViewLayout:[[CalendarFlowLayout alloc]init]];
timeline = [NSArray arrayWithObjects:@"8:00", @"9:00",@"10:00",@"11:00",@"12:00",@"13:00",@"14:00",@"15:00",@"16:00",@"17:00",@"18:00",@"19:00",@"20:00",@"21:00",@"22:00",nil];
weekline=[NSArray arrayWithObjects:@"Mon", @"Tue",@"Wen",@"Thr",@"Fri",@"Sat",@"Sun",nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger) numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return 128;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell * …Run Code Online (Sandbox Code Playgroud)