ios - How can i populate the right swreveal view controller with an array of prototype cells created in main.storyboard -
im new stack overflow , first post please patient me!
i have sw_rear , sw_front set , work perfectly.
however when tried creating table view filled prototype cells sw_right linked array seperate 1 have in sw_rear found when tried swiping or pushing button access right menu app crashes without errors printing log.
(i have 2 arrays in 2 seperate swift files rearvc & rightvc linked 2 seperate tableviews sw_rear & sw_right)
i have searched online last week (all google hyperlinks purple!!) , cant seem find answer @ all. thought copying code (found in rear reveal table vc) right table vc work unfortunately not!
(coded in swift, fyi used bridging header swrevealvc dont know obj c)
import foundation class reartablevc: uitableviewcontroller { var reartablearray = [string]() override func viewdidload() { reartablearray = ["a", "b", "c", "d", "e", "f"] } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return reartablearray.count } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier(reartablearray[indexpath.row], forindexpath: indexpath) uitableviewcell cell.detailtextlabel?.text = reartablearray[indexpath.row] return cell } } as can see im using "cell.detailtextlabel?.text" customised prototype cells ive built in main.storyboard ones populating list.
both correctly linked nav controller other scenes.
i know part fine, im stuck code.
in root view controller im running code , works charm no problems there.
import foundation class avc : uiviewcontroller { @iboutlet var menubuttonleft: uibarbuttonitem! @iboutlet var menubuttonright: uibarbuttonitem! override func viewdidload() { menubuttonleft.target = self.revealviewcontroller() menubuttonleft.action = #selector(swrevealviewcontroller.revealtoggle(_:)) menubuttonright.target = self.revealviewcontroller() menubuttonright.action = #selector(swrevealviewcontroller.rightrevealtoggle(_:)) self.view.addgesturerecognizer(self.revealviewcontroller().pangesturerecognizer()) } } any appreciated , more willing add more info needed!!
thanks.
(sorry cant add pictures)
solution: hi after beating around bush hours found solution, very excruciatingly simple solution. in swrevealviewcontroller.m 3 important parts missing. don't know obj-c @ figured these lines missing code rightviewcontroller after adding them worked!
- (id)init { return [self initwithrearviewcontroller:nil frontviewcontroller:nil rightviewcontroller:nil]; } - (id)initwithrearviewcontroller:(uiviewcontroller *)rearviewcontroller frontviewcontroller:(uiviewcontroller *)frontviewcontroller rightviewcontroller:(uiviewcontroller *)rightviewcontroller; { self = [super init]; if ( self ) { [self _initdefaultproperties]; [self _performtransitionoperation:swrevealcontrolleroperationreplacerearcontroller withviewcontroller:rearviewcontroller animated:no]; [self _performtransitionoperation:swrevealcontrolleroperationreplacefrontcontroller withviewcontroller:frontviewcontroller animated:no]; [self _performtransitionoperation:swrevealcontrolleroperationreplacerightcontroller withviewcontroller:rightviewcontroller animated:no]; } all added
return [self initwithrearviewcontroller:nil frontviewcontroller:nil rightviewcontroller:nil]; and
rightviewcontroller:(uiviewcontroller *)rightviewcontroller; and
_performtransitionoperation:swrevealcontrolleroperationreplacerightcontroller withviewcontroller:rightviewcontroller animated:no]; lines
edit 2 (requested info)
#pragma mark - init - (id)initwithcoder:(nscoder *)adecoder { self = [super initwithcoder:adecoder]; if ( self ) { [self _initdefaultproperties]; } return self; } - (id)init { return [self initwithrearviewcontroller:nil frontviewcontroller:nil rightviewcontroller:nil]; } - (id)initwithrearviewcontroller:(uiviewcontroller *)rearviewcontroller frontviewcontroller:(uiviewcontroller *)frontviewcontroller rightviewcontroller:(uiviewcontroller *)rightviewcontroller; { self = [super init]; if ( self ) { [self _initdefaultproperties]; [self _performtransitionoperation:swrevealcontrolleroperationreplacerearcontroller withviewcontroller:rearviewcontroller animated:no]; [self _performtransitionoperation:swrevealcontrolleroperationreplacefrontcontroller withviewcontroller:frontviewcontroller animated:no]; [self _performtransitionoperation:swrevealcontrolleroperationreplacerightcontroller withviewcontroller:rightviewcontroller animated:no]; } return self; }
Comments
Post a Comment