UA-17470720-3

Jump to content


Photo
- - - - -

How To Use "Add Button" If Not Using A Navigation Controller


  • Please log in to reply
27 replies to this topic

#21 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 22 November 2013 - 05:56 PM

LOL - I at least figured out why it worked on the simulator - it was remember the settings from the iPhone simulation.  Once I deleted the app from the simulator and tried to run the iPad simulator it did NOT WORK. Then I did runt the iPhone version and it works as expected.  Guess what - run the iPad on the simulator and it works - must be "remembering" something from the iPhone simulation version.

 

Perhaps this is a clue...

 

John



#22 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 22 November 2013 - 06:40 PM

ok so first.. in the video thats not a popover controller.. thats an modal form sheet

with the sim app open, if u click the sim menu there is an item to "reset content and settings" this resets the sim to default in every way and removes everything.. comes in handy

 

lets try something like this for the iPads tableViewModel after you set it to the iPriceModel

self.tableViewModel.detailViewController.modalPresentationStyle = UIModalPresentationPageSheet;

  • designwerks likes this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#23 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 22 November 2013 - 07:11 PM

Thanks Ozie,

 

At least you helped me narrow it down - I was using the wrong terminology - getting tired I guess.  So what you saw in the video is certainly what I'd like to achieve (if possible).

 

Did try your code as shown above - no luck... no error message / no crash / just no reaction to the + sign touch...

 

John



#24 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 22 November 2013 - 07:27 PM

nar i don't use that code above.. i just know its there and thought it might have worked:)

 

what happens if u tap one of the rows in the table?? does a sheet open up to edit the data in??


P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#25 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 22 November 2013 - 07:34 PM

Yes, when it was working in the simulator - I was able to tap on an existing row and edit it as designed.

 

I'll keep trying different variations of the above...

 

Thanks for all your help.

 

John



#26 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 22 November 2013 - 07:43 PM

in the add button event try this.. because if there is no section 0 then you can add anything

SCArrayOfObjectsModel *arrayOfObjectsModel=(SCArrayOfObjectsModel *)self.tableViewModel;    
[arrayOfObjectsModel dispatchEventAddNewItem];

make sure with a break point that the arrayOfObjectsModel is not nil..

i don't use any special code or anything and for me touching a row or clicking the UIButton to create a new item on the view pops open a sheet view to edit add objects


  • designwerks and wizgod like this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#27 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 22 November 2013 - 07:56 PM

Oh My God - it works!  Thank you so much!!! How do I repay you for all your help!



#28 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 141 posts
  • LocationKingsville, Ontario, Canada
Reputation: 23
Excellent

Posted 24 November 2013 - 06:14 AM

For those that might be interested here is the final code that works for me on the iPad...

 

In your .h file...

 

- (IBAction)pressedAdd:(id)sender;

 

In your .m file...

 

[super viewDidLoad];

    

    // use this to load iPad add button because we do not have a navigation bar in custom theme setup

    

    self.addButton.target = self;

    self.addButton.action = @selector(pressedAdd);

    

    // end of unique add button for iPad code

 

- (IBAction)pressedAdd:(id)sender {

 

    SCArrayOfObjectsModel *arrayOfObjectsModel=(SCArrayOfObjectsModel *)self.tableViewModel;

    [arrayOfObjectsModel dispatchEventAddNewItem];

}

 

Thanks to all that helped me solve this problem!

 

John


  • wizgod likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users