Up vote 0 down vote favorite share g+ share fb share tw.
I am so poor in English, hope you guys can understand what I am saying. There is a class called Notice and it has a NSString parameter called readState. I just want check out the notice's readState then set the cell's backgroundColor When the TableViewController run this function: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = indexPath row; Notice *notice = allNoticeArray objectAtIndex:row; NSLog(@"Row:%d readState:%@",row,notice.
ReadState);//There is no problem like"Row:0 readState:0" if ( notice. ReadState isEqualToString:@"0" ) //There is an error occurs:-__NSCFNumber isEqualToString:: unrecognized selector sent to instance 0x6930e50 { cell. BackgroundColor = UIColor grayColor; } else { cell.
BackgroundColor = UIColor whiteColor; } } I am sure that all the notice's readState is NSString 0. Then I change the code to: if ( @"0" isEqualToString:notice. ReadState ) The error is gone,but the code : cell.
BackgroundColor = UIColor grayColor; does not run ,so the all cell's backgroundColor is white, The cells'background color should be grayColor. And I don't konw how to fix this problem,so please help with this. Thanks a lot!
And there is my Notice. H class: #import @interface Notice : NSObject { NSString *body; NSString *departmentName; NSString *noticeId; NSString *isTop; NSString *readState; NSString *realName; NSString *title; } @property (nonatomic, strong) NSString *body; @property (nonatomic, strong) NSString *departmentName; @property (nonatomic, strong) NSString *noticeId; @property (nonatomic, strong) NSString *isTop; @property (nonatomic, strong) NSString *readState; @property (nonatomic, strong) NSString *realName; @property (nonatomic, strong) NSString *title; - (id)initWithBody:(NSString *)bodyArgument departmentName:(NSString *)departmentNameArgument noticeId:(NSString *)noticeIdArgument isTop:(NSString *)isTopArgument readState:(NSString *)readStateArgument realName:(NSString *)realNameArgument title:(NSString *)titleArgument; @end NSError *error = request error; if (!error) { NSString *responseString = request responseString; NSDictionary *responseDict = responseString JSONValue; NSArray *noticeArray = responseDict objectForKey:@"d"; NSMutableArray *arrayOfAllNotice = NSMutableArray alloc init; NSMutableDictionary *allTitleDic = NSMutableDictionary alloc init; for (NSDictionary *noticeDic in noticeArray) { NSString *body = noticeDic objectForKey:@"Body"; NSString *departmentName = noticeDic objectForKey:@"DepartmentName"; NSString *noticeId = noticeDic objectForKey:@"Id"; NSString *isTop = noticeDic objectForKey:@"IsTop"; NSString *readState = noticeDic objectForKey:@"ReadState"; NSString *realName = noticeDic objectForKey:@"RealName"; NSString *title = noticeDic objectForKey:@"Title"; Notice *notice = Notice alloc initWithBody:body departmentName:departmentName noticeId:noticeId isTop:isTop readState:readState realName:realName title:title; arrayOfAllNotice addObject:notice; allTitleDic setObject:notice. NoticeId forKey:notice.
Title; } ios uitableviewcell unrecognized-selector link|improve this question edited Mar 19 at 6:30 asked Mar 19 at 5:57Jxdwinter376 100% accept rate.
– Aadhira Mar 19 at 6:09 Sure,I edit the question, and now you can see the Notice. H class. – Jxdwinter Mar 19 at 6:16 Are you sure you are populating your readState with NSString?
– anticyclope Mar 19 at 6:19 The code is just like this. – Jxdwinter Mar 19 at 6:31 WOW,and I konw why ,cause the json data is not a NSString, it is an NSInteger! Thanks guys for helping me!
Anybody answer this, and then I will choose an answer to close this question. – Jxdwinter Mar 19 at 6:47.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.