大佬教程收集整理的这篇文章主要介绍了iphone – 崩溃[[NSBundle mainBundle] loadNibnamed:owner:options:],大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
谢谢,
这是我的UITableViewCell接口和实现方法.我不知道我真的需要分配init标签.我试过两种方式…
// ArrivalTimesCell.h #import <UIKit/UIKit.h> @interface ArrivalTimesCell : UITableViewCell { IBOutlet UILabel *cityArrivalTimeLabel; IBOutlet UILabel *optimumArrivalTimeLabel; IBOutlet UILabel *arrivalAvoidTimesLabel; IBOutlet UILabel *arrivalTimeNotSetLabel; } @property (nonatomic,retain)IBOutlet UILabel *cityArrivalTimeLabel; @property (nonatomic,retain)IBOutlet UILabel *optimumArrivalTimeLabel; @property (nonatomic,retain)IBOutlet UILabel *arrivalAvoidTimesLabel; @property (nonatomic,retain)IBOutlet UILabel *arrivalTimeNotSetLabel; @end // ArrivalTimesCell.m #import "ArrivalTimesCell.h" @implementation ArrivalTimesCell @synthesize arrivalTimeNotSetLabel,arrivalAvoidTimesLabel,optimumArrivalTimeLabel,cityArrivalTimeLabel; - (id)initWithStyle:(UITableViewCellStylE)style reusEIDentifier:(NSString *)reusEIDentifier{ self = [super initWithStyle:style reusEIDentifier:reusEIDentifier]; if (self) { arrivalTimeNotSetLabel = [[UILabel alloc] init]; arrivalAvoidTimesLabel = [[UILabel alloc] init]; optimumArrivalTimeLabel = [[UILabel alloc] init]; cityArrivalTimeLabel = [[UILabel alloc] init]; } return self; } - (void)setSELEcted:(BOOL)SELEcted animated:(BOOL)animated{ [super setSELEcted:SELEcted animated:animated]; } - (void)dealloc{ [super dealloc]; [arrivalTimeNotSetLabel release]; arrivalTimeNotSetLabel = nil; [arrivalAvoidTimesLabel release]; arrivalAvoidTimesLabel = nil; [optimumArrivalTimeLabel release]; optimumArrivalTimeLabel = nil; [cityArrivalTimeLabel release]; cityArrivalTimeLabel = nil; } @end
这是UITableView的cellForRowATindexPath的一部分
// TripEditViewController.m #import "ArrivalTimesCell.h" @implementation TripEditViewController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { CellIdentifier = @"ArrivalTimesCell"; ArrivalTimesCell *cell = (ArrivalTimesCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil){ NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ArrivalTimesCell" owner:nil options:nil]; for (id currentObject in topLevelObjects) { if ([currentObject isKindOfClass:[UITableViewCell class]]) { cell = (ArrivalTimesCell *) currentObject; break; } } } cell.cityArrivalTimeLabel.text = @"whatever" cell.arrivalAvoidTimesLabel.text = @"whatever"; cell.optimumArrivalTimeLabel.text = @"whatever"; cell.arrivalTimeNotSetLabel.text = @"whatever"; return cell; }
程序执行停止在loadNibNamed行上,而控制台中没有任何注释.如果我“进入”我得到以下,我不知道与我的崩溃的原因有关,而是由于nib的加载不正确的结果…
以上是大佬教程为你收集整理的iphone – 崩溃[[NSBundle mainBundle] loadNibnamed:owner:options:]全部内容,希望文章能够帮你解决iphone – 崩溃[[NSBundle mainBundle] loadNibnamed:owner:options:]所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。