小编jit*_*hin的帖子

无法从其DataSource获取单元格

以下代码有什么问题

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    NSString *CellIdentifier  = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    cell.textLabel.text = @"hello";

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
Run Code Online (Sandbox Code Playgroud)

但我无法从其dataSource获取一个单元格

整个例外是

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7ffe0b092800; frame = (0 97; 414 590); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7ffe0acf3b10>; layer = <CALayer: 0x7ffe0aceb6e0>; contentOffset: {0, 0}; contentSize: {414, 88}>) failed to obtain a cell from its dataSource (<AllContactsViewController: 0x7ffe0ace60f0>)'
Run Code Online (Sandbox Code Playgroud)

我为表视图设置了委托和数据源

objective-c uitableview ios

63
推荐指数
3
解决办法
6万
查看次数

在objective-c中获取一周的第一天和最后一天

我想在本周的第一天获得每个人的特定区域设置.例如,周日美国周开始周日和周一其他国家.

我想在星期一开始为大家开始,这是因为我想将它用于SQLQuery.

我有这个:

NSDate *weekDay = [NSDate date]; //any date in the week in which to calculate the first or last weekday   
 NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *components = [gregorian components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:weekDay];
[components setDay:([components day]-([components weekday]-[[NSCalendar currentCalendar] firstWeekday]))];

NSDate *firstWeekday = [gregorian dateFromComponents:components];
NSDate *lastWeekday = [[gregorian dateFromComponents:components] dateByAddingTimeInterval:7 * 24 * 3600 - 1];
NSLog(@"first - %@ \nlast - %@", firstWeekday, lastWeekday);
Run Code Online (Sandbox Code Playgroud)

如果你的语言环境周从星期一开始,但是如果从星期日开始,那么它可以正常工作.

所以想象今天是2015年10月11日周日地区将返回第11周的第一天,最后一天,17周一地区将返回第5周的第一天,即最后一天11

我想在我的应用程序执行的任何地方返回第二个选项.

谢谢.最好的祝福.

locale objective-c nsdate nsdateformatter nsdatecomponents

1
推荐指数
1
解决办法
2200
查看次数

使用Firebase Data Swift,Xcode 7填充UITableViewController

我有工作swiftXcode 7.我是全新的Swift, Xcode, and Firebase.我想UITableViewController在我的iOS应用程序中有三个s.前两个TableView controllers需要动态内容,第三个TableView控制器需要静态内容.我希望第二个和第三个TableView控制器根据在前一个TableView控制器上按下的内容显示数据.所有数据都来自我的Firebase.我不知道从哪里开始.请指出我正确的方向!谢谢!

uitableview ios firebase

1
推荐指数
1
解决办法
8553
查看次数