나는 셀로 나눈 TableView를 가지고 있습니다. 셀의 텍스트는 UILocalNotification에 대한 fireDate입니다. 내 코드 :날짜로 UITableView의 섹션을 나누는 방법
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [[[UIApplication sharedApplication]scheduledLocalNotifications]count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
cellView *cell = (cellView *)[tableView dequeueReusableCellWithIdentifier: @"Cell" forIndexPath:indexPath];
NSArray *localnotifications = [[UIApplication sharedApplication]scheduledLocalNotifications];
UILocalNotification *localNotification = [localnotifications objectAtIndex:indexPath.row];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM/dd/yyyy"];
NSString *timeString = [formatter stringFromDate:localNotification.fireDate];
[cell.textlabel setText:timeString];
return cell;
}
섹션을 날짜로 나눈 생성 방법은 무엇입니까?
이것은이 게시물과 비슷합니다. http://stackoverflow.com/questions/11053741/ios-uitableview-sections-based-on-date-ranges –