iOS UITextField.inputView error -


im trying add custom inputview tableviewcell input field, when so, mixed view in app , app crashes. have watched previous solutions haven't found working me. can me that?

#pragma mark - tableview data source  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     // return number of sections.     return 1; }   - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     // return number of rows in section.     return self.taskquestionobjects.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     // dequeue custom cell here     taskmanagerquestionandanswertableviewcell *cell = [tableview dequeuereusablecellwithidentifier:taskquestionanswercellidentifier];      taskmanagerquestion *questionobject = self.taskquestionobjects[indexpath.row];      cell.taskquestionlabel.text = questionobject.title;      cell.taskanswertextfield.inputview = [[[nsbundle mainbundle] loadnibnamed:@"taskmanagerpickerkeyboardviewcontroller" owner:self options:nil] objectatindex:0];      return cell; } 

console log:

    2014-09-12 12:26:19.615 taskmanager[24317:60b] unable simultaneously satisfy constraints.     @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints)  (     "<nslayoutconstraint:0x167906e0 v:[uitableview:0x16bc6c00(417)]>",     "<nslayoutconstraint:0x167932d0 v:[_uilayoutguide:0x16792e00]-(0)-[uitableview:0x16bc6c00]>",     "<nslayoutconstraint:0x16793360 v:[uitableview:0x16bc6c00]-(87)-[_uilayoutguide:0x16792ff0]>",     "<_uilayoutsupportconstraint:0x167917d0 v:[_uilayoutguide:0x16792e00(64)]>",     "<_uilayoutsupportconstraint:0x16791770 v:|-(0)-[_uilayoutguide:0x16792e00]   (names: '|':uiview:0x16791280 )>",     "<_uilayoutsupportconstraint:0x16791890 v:[_uilayoutguide:0x16792ff0(0)]>",     "<_uilayoutsupportconstraint:0x16791830 _uilayoutguide:0x16792ff0.bottom == uiview:0x16791280.bottom>",     "<nsautoresizingmasklayoutconstraint:0x1677d2f0 h=--& v=--& v:[uiview:0x16791280(480)]>" )  attempt recover breaking constraint  <nslayoutconstraint:0x167906e0 v:[uitableview:0x16bc6c00(417)]>  break on objc_exception_throw catch in debugger. methods in uiconstraintbasedlayoutdebugging category on uiview listed in <uikit/uiview.h> may helpful. 2014-09-12 12:26:38.039 taskmanager[24317:60b] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'can't add self subview' *** first throw call stack: (0x30228f83 0x3aaa3ccf 0x30228ec5 0x32a51535 0x32a514bf 0x32c19f71 0x32a57ac5 0x32c19879 0x32bd6b27 0x32af3d63 0x32af3b6d 0x32af3b05 0x32a45d59 0x326c362b 0x326bee3b 0x326beccd 0x326be6df 0x326be4ef 0x32a493e1 0x301f420b 0x301f36db 0x301f1ecf 0x3015cebf 0x3015cca3 0x350b6663 0x32aa914d 0xe85c1 0x3afb0ab7) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)  

the inputview property defined (uiview*), not (uiviewcontroller*). need use view property of loaded view controller rather view controller when assigning inputview. think should store loaded view controller property, loading each time nib when cell reloaded isn't application performance. although last time tried loadnibnamed in table view in ios 4.0, didn't seem use caching then. how trying this:

// class extension lazy loaded property @interface mytableviewcontroller() @property (readonly) uiviewcontroller *inputvc; @end   @implementation mytableviewcontroller {     uiviewcontroller *_inputvc; }  - (uiviewcontroller *)inputvc {     if (_inputvc == nil) {         _inputvc = [[[nsbundle mainbundle] loadnibnamed:@"taskmanagerpickerkeyboardviewcontroller" owner:nil options:nil] objectatindex:0];     }     return inputvc; }  ...  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     ...     cell.taskanswertextfield.inputview = self.inputvc.view;     ... }  @end 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -