0
我想設置一個LocalNotification,然後能夠顯示在UICollectionView上。 但是,我只知道如何使它顯示在UITable上。我應該怎麼做才能將其從UITable轉換爲UIcollectionview?我希望UIcollectionview能夠在後臺顯示帶有背景圖像的時間和日期的UIlabel。UIcollectionView上的LocalNotification顯示
這是我用本地通知構建UITable的代碼。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of notifications
return [[[UIApplication sharedApplication] scheduledLocalNotifications] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.textColor = [UIColor whiteColor];
// Get list of local notifications
NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
UILocalNotification *notif = [notificationArray objectAtIndex:indexPath.row];
// Display notification info
[cell.textLabel setText:notif.alertBody];
return cell;
}
你有什麼試過的?集合視圖的API與表視圖非常相似。 – rdelmar 2013-04-05 19:10:58