表格跳转

//首先在viewdidload写个方法



-(void)collectionView:(UICollectionView*)collectionView didSelectItemAtIndexPath:(NSIndexPath*)indexPath{

    NSLog(@"第%ld分区---第%ld行",indexPath.section,indexPath.row);

    NewViewController  *new = [[NewViewController alloc]init];


    NSString*str =_dic.allKeys[indexPath.section];


    NSString*name = [[[_dicobjectForKey:str]objectAtIndex:indexPath.row]allKeys][0];


    new.name= name;

    new.img= [UIImageimageNamed:[[_dicobjectForKey:str]objectAtIndex:indexPath.row][name]];

    [self presentViewController:new animated:YES completion:nil];

}

//然后创建一个新的页面,.h写上name,image属性

//然后在.m写内容

-(UIImageView*)imageView{

    if (!_imageView) {

        _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-50)];

    }

    return _imageView;

}

-(UILabel*)label{

    if(!_label) {

        _label= [[UILabelalloc]initWithFrame:CGRectMake(200,self.view.frame.size.height-40,200,30)];

    }

    return _label;

}

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];

    [self.viewaddSubview:self.imageView];

    [self.viewaddSubview:self.label];

    self.imageView.image = self.img;

    self.label.text=self.name;


}

-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event{

    [self dismissViewControllerAnimated:YES completion:nil];

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,803评论 1 32
  • #import "ViewController.h" #import "MyCollectionViewCell....
    b6e7b0be2603阅读 2,662评论 0 3
  • 1.badgeVaule气泡提示 2.git终端命令方法> pwd查看全部 >cd>ls >之后桌面找到文件夹内容...
    i得深刻方得S阅读 10,220评论 1 9
  • 前言 最近忙完项目比较闲,想写一篇博客来分享一些自学iOS的心得体会,希望对迷茫的你有所帮助。博主非科班出身,一些...
    GitHubPorter阅读 5,314评论 9 5
  • 1、改变 UITextField 占位文字 颜色和去掉底部白框 [_userName setValue:[UICo...
    i_MT阅读 4,687评论 0 2