大佬教程收集整理的这篇文章主要介绍了ios – 当我选择UITableViewCell时,我的视图控制器标签就是一个动作,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
目前,当选择单元格时,标签上显示先前选择的单元格内容.这是我的ViewController.m文件的当前内容(委托和数据源在头文件中声明)
#import "ViewController.h" @interface ViewController () @property (weak,nonatomiC) IBOutlet UITableView *tableView; @property (strong,nonatomiC) NSArray *tweetsArray; @end @implementation ViewController - (void)viewDidLoad { self.tableView.datasource = self; self.tableView.delegate = self; self.tweetsArray = [[NSArray alloc] initWithObjects: @"Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus",@"eleifend ac,enim. Aliquam lorem ante,dapibus in,viverra quis,feugiat a,tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Cu",@" Nam quam nunc,blandit vel,luctus pulvinar,hendrerit id,lorem. Maecenas nec odio et ante Tincidunt tempus. Donec vitae sapien ut libero v",@" eros faucibus Tincidunt. Duis Leo. Sed fringilla mauris sit amet nibh. Donec soDales sagittis magna. Sed consequat,Leo eget bibendum soDales",nil]; [super viewDidLoad]; // Do any additional setup after loading the view,typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.tweetsArray.count; } - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { static NS@R_450_10495@ng *cellIdentifier = @"SetTingsCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; NS@R_450_10495@ng *tweet = [self.tweetsArray objectATindex:indexPath.row]; [cell.textLabel setText:tweet]; [cell.detailTextLabel setText: @"Cody be Cray"]; return cell; } - (void) tableView:(UITableView *)tableView didDeSELEctRowATindexPath:(NSIndexPath *)indexPath { DetailViewController *dvc = [self.storyboard instantiateViewControllerWithIdentifier: @"DetailViewController"]; dvc.tweet = [self.tweetsArray objectATindex:indexPath.row]; [self.navigationController pushViewController:dvc animated:YES]; } @end
以上是大佬教程为你收集整理的ios – 当我选择UITableViewCell时,我的视图控制器标签就是一个动作全部内容,希望文章能够帮你解决ios – 当我选择UITableViewCell时,我的视图控制器标签就是一个动作所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。