`
修博龙泉
  • 浏览: 313103 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

uibutton 对象传递

 
阅读更多
UIButton *btn = (UIButton *)[cell viewWithTag:101];
    btn.frame = CGRectMake(5, 5, 150, hei - 10);
    [btn addTarget:self action:@selector(selectPic:) forControlEvents:UIControlEventTouchUpInside];
    
    if ([indexPath section]==0) {
        picture = [guangPicLeftArray objectAtIndex:[indexPath row]];
    }else{
        picture = [guangPicRightArray objectAtIndex:[indexPath row]];
    }
  
    [picView setImageWithURL:[NSURL URLWithString:picture.picUrl]];
    [btn setImage:picView.image forState:UIButtonTypeCustom];
    //begin
    if (picture!=nil) {
         [btnToPicDic setObject:picture forKey:btn.description];
        NSLog(btn.description);
    }




- (void)selectPic:(UIButton *)aBtn{
    DetailViewController *detail = [[DetailViewController alloc]init];
    detail.picture = [btnToPicDic objectForKey:aBtn.description];
    [self presentModalViewController:detail animated:YES];
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics