当UITableView
用户UIView
点击UITableViewCell
. 我想让推送视图的标题成为推送视图来自的单元格中的文本。我正在尝试声明NSUInteger
何时选择该行以创建使用ObjectatIndex的字符串。我的理解是objectAtIndex
接受 type NSUInteger
。这对我来说真的没有用。
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//get index number
NSNumber *selRow = [[NSNumber alloc] initWithInteger:indexPath.row];
NSUInteger rows = (NSUInteger)selRow;
NSLog(@"%@",rows); //this outputs correctly
NSString *pushTitle = [[self.WorkoutListArray objectAtIndex:rows] stringValue]; //error on this line
//declares a new view controller when something is selected -- uses story board to initialize
WorkoutPushViewController *newView = [self.storyboard instantiateViewControllerWithIdentifier:@"WorkoutPush"];
//when selected a new view is pushed
[self.navigationController pushViewController:newView animated:YES];
//adds a title to the push view
newView.title = pushTitle;
}
@end
我得到一个
NSRangeExcpetion 错误
当我尝试声明字符串时。我尝试了几种方法来声明NSString
from theNSArray
但还没有运气。我希望我的问题很清楚:)