#import "FavoriteCell.h"@implementation FavoriteCell@synthesize lblGaugeID,lblMainTitle,bgImage;- (ID)initWithStyle:(UItableVIEwCellStyle)style reuseIDentifIEr:(Nsstring *)reuseIDentifIEr{ bgImage = [UIImage imagenamed:@"tableCellBG.png"]; self = [super initWithStyle:style reuseIDentifIEr:reuseIDentifIEr]; if (self) { UIcolor *transparentBG = [UIcolor colorWithRed:0.0 green:0.0 blue:0.0 Alpha:0.0]; UIcolor *foregroundcolor = [UIcolor colorWithRed:1.0 green:1.0 blue:1.0 Alpha:1.0]; //UIcolor *shadowColot = [UIcolor colorWithWhite:0.75 Alpha:1.0]; CGSize size = self.contentVIEw.frame.size; self.backgroundVIEw = [[UIImageVIEw alloc] initWithImage:bgImage]; self.lblMainTitle = [[UILabel alloc] initWithFrame:CGRectMake(8.0,0.5,size.wIDth-16,size.height-40)]; [self.lblMainTitle setFont:[UIFont systemFontOfSize:12.0]]; [self.lblMainTitle setTextAlignment:NSTextAlignmentleft]; [self.lblMainTitle setautoresizingMask:(UIVIEwautoresizingFlexibleWIDth | UIVIEwautoresizingFlexibleHeight)]; [self.lblMainTitle setBackgroundcolor:transparentBG]; self.lblGaugeID = [[UILabel alloc] initWithFrame:CGRectMake(20.0,31.0,size.height-40)]; [self.lblGaugeID setFont:[UIFont boldSystemFontOfSize:15.0]]; [self.lblGaugeID setTextAlignment:NSTextAlignmentleft]; [self.lblGaugeID setTextcolor:foregroundcolor]; [self.lblGaugeID setShadowOffset:CGSizeMake(0.2,0.2)]; [self.lblGaugeID setautoresizingMask:(UIVIEwautoresizingFlexibleWIDth | UIVIEwautoresizingFlexibleHeight)]; [self.lblGaugeID setBackgroundcolor:transparentBG]; [self.contentVIEw addSubvIEw:lblGaugeID]; [self.contentVIEw addSubvIEw:lblMainTitle]; } return self;}@end
这里是它的实例(摘自我的视图控制器类):
-(FavoriteCell*)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{ Nsstring *cellIDentifIEr = @"favoriteCell"; FavoriteCell *cell = (FavoriteCell*)[tableVIEw dequeueReusableCellWithIDentifIEr:cellIDentifIEr]; //error if(cell == nil){ cell = [[FavoriteCell alloc] initWithStyle:UItableVIEwCellStyleDefault reuseIDentifIEr:cellIDentifIEr]; } Nsstring *sitename = [faveKeys objectAtIndex:indexPath.row]; [cell.lblMainTitle setText:sitename]; [cell.lblGaugeID setText:[allFavorites objectForKey:sitename]]; return cell;}
这是完整的错误消息:
@H_502_10@* Terminating app due to uncaught exception ‘NSinvalidargumentexception’,reason: ‘-[__NSCFConstantString instantiateWithOwner:options:]: unrecognized selector sent to instance 0x24bb0’
谁能提供一些关于检查的建议?谢谢!维维安
解决方法 使用 – (voID)registerNib:(UINib *)nib forCellReuseIDentifIEr 总结以上是内存溢出为你收集整理的ios – 使用自定义表格单元格时“无法识别的选择器发送到实例”全部内容,希望文章能够帮你解决ios – 使用自定义表格单元格时“无法识别的选择器发送到实例”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)