我用这个https://github.com/SebastienThiebaud/STTweetLabelSTTweetLabel介绍的UITableViewCell
但我想将它添加到的UITableViewCell如下
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
STTweetLabel *_tweetLabel = [[STTweetLabel alloc] initWithFrame:CGRectMake(20.0, 60.0, 280.0, 230.0)];
[_tweetLabel setFont:[UIFont fontWithName:@"HelveticaNeue" size:17.0]];
[_tweetLabel setTextColor:[UIColor blackColor]];
STLinkCallbackBlock callbackBlock = ^(STLinkActionType actionType, NSString *link) {
SString *displayString = NULL;
switch (actionType) {
case STLinkActionTypeAccount:
displayString = [NSString stringWithFormat:@"Twitter account:\n%@", link];
break;
case STLinkActionTypeHashtag:
displayString = [NSString stringWithFormat:@"Twitter hashtag:\n%@", link];
break;
case STLinkActionTypeWebsite:
displayString = [NSString stringWithFormat:@"Website:\n%@", link];
break;
}
NSLog(@"%@",displayString);
};
[_tweetLabel setCallbackBlock:callbackBlock];
[_tweetLabel setText:@"http://www.google.com"];
[cell addSubview:_tweetLabel];
return cell;
}
但错误是:
-[__NSArrayM set]: unrecognized selector sent to instance 0x750b160
2013-04-03 15:36:36.425 Shahona Fashion[18426:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM set]: unrecognized selector sent to instance 0x750b160'
所以我的问题是,是否有可能添加intro tableView单元格,或者有什么方法可以通过这种方式来检测url?
在此先感谢..
不,这不是我的问题,我只是问关于使用STLweetLabel进入细胞 – SimpleojbC
道歉。我误解了这个问题。您最好创建一个自定义单元类并在那里实现您的STTweetLabel。但在你做任何事情之前,你必须摆脱你的错误,正如我所说的,它与某个数组有关。 – joeByDesign