如何在uitbaleview中单击按钮创建popover

时间:2017-01-13 05:46:17

标签: ios objective-c iphone

伙计我在uitableview中创建popover单元格按钮单击目标c.i需要类型design.how实现这一个。我正在使用fbpopover,我已经尝试自定义但我无法找到确切的解决方案。

enter image description here

1 个答案:

答案 0 :(得分:0)

按照步骤

  1. 在设置按钮下方customtableviewCell取一个UIButton(说btnHidePost)(说btnSetting)。别忘了给出限制。
  2. 创建一个只在您的类中为global的可变数组。 (说,arrMutBtnSelected
  3. 最初,在viewDidLoad
  4. // array of bools, initially all false as not any button is selected // arrPost is the array of your post, assumine here it is total count for your rows. for (int i=0; i < arrPost.count; i++) { [arrMutBtnSelected addObject:[NSNumber numberWithBool:false]]; }

    1. cellForRow
    2. if (arrMutBtnSelected[indexPath.row] == [NSNumber numberWithBool:true]) { fbCell.btnSetting.selected = true; fbCell.btHidePost.hidden = false; } else{ fbCell.btnSetting.selected = false; fbCell.btHidePost.hidden = true; } }

      5.按钮操作,

      [arrMutBtnSelected removeAllObjects]; for (int i=0; i < arrPost.count; i++) { [arrMutBtnSelected addObject:[NSNumber numberWithBool:false]]; } [arrMutBtnSelected replaceObjectAtIndex:sender.tag withObject:[NSNumber numberWithBool:true]];