ITeye博客

uibutton 对象传递

修博龙泉 · 2012-09-24 15:49 · ios开发学习相关 · 移动开发 · Markdown


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];
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。