UA-17470720-3

Jump to content


Photo
- - - - -

Dream Model... Is This Possible...


  • Please log in to reply
11 replies to this topic

#1 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 27 August 2015 - 01:06 PM

Please see attached screen capture to see what I would like to achieve...

 

John

 

Attached File  Screenshot 2015-08-27 16.45.32.png   413.38K   37 downloads



#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 28 August 2015 - 07:12 AM

Hi John,

 

Yes, this can be easily achieved using STV. Please find attached a modified version of our TasksApp sample that does exactly that.

Attached Files


  • wizgod likes this

#3 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 28 August 2015 - 03:26 PM

Thanks Tarek,

 

I played with your provided sample and it is exactly what I am looking for.  I cant wait to try what you are teaching me on my app.  I'll let you know how it progresses.  This STV 5 really is great!

 

As always, thank you for taking the time to show me the way...

 

John



#4 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 28 August 2015 - 11:25 PM

Almost there...

 

Can you review... the new custom controller does display per your example, but contains no core data... Confused...

 

P.S. that new controller and the edit button DO WORK...

 

In Reference to Interface Builder image...

 

I can add new items from Plant Detail Controller - GREAT

I can view the new custom controller when I click on an item created in Plant Detail

I can edit the changes of the item in Plant Detail from Plant Detail 2 controller (based on your code) - thanks

But, that darn view controller Plant Detail 2 doesn't contain any data...

 

I tried adding code here:

 

- (void)tableViewModel:(SCTableViewModel *)tableViewModel didSelectRowAtIndexPath:(NSIndexPath *)indexPath

 

But no luck...

 

John

Attached Files



#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 31 August 2015 - 06:19 AM

Hi John,

 

It will be a lot better for us if you could kindly explain your problem in the context of the previously attached TasksApp_mod project, since I have no reference of your Plant application. 

 

On a side note, you should use cellActions.didSelect when responding to a cell selection (the method you posted has been long deprecated since STV 3.0 and no longer works). For a full explanation of STV Actions, please refer to: http://sensiblecocoa...est/#STVActions



#6 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 31 August 2015 - 04:35 PM

Thanks Tarek,

 

So I did more digging and got it to work!  I was using curly brace binding like {name} and I see in your code you used...

 

NSString *taskName = [self.tableViewModel.masterBoundObject valueForKey:@"name"];

    self.taskNameLabel.text = taskName;

 

I then connected taskNameLabel in interface builder to my label and it works!   

 

So it works, I did not know that for that custom controller I had to use code and not the curly brace binding... all good, thank you for all your help.  I am grateful for your help.

 

John



#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 31 August 2015 - 05:10 PM

You're most welcome John. Curly brace binding only works in STV-related controls (all subclasses of SCCustomCell to be specific). 'taskNameLabel' is just a regular UILabel that STV knows nothing about.



#8 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 31 August 2015 - 06:34 PM

Small reload issue... see image attached... all is working except when you go to final detail controller as it moves back to present the cool custom controller that info is not updated until the user moves to the first controller.  Any ideas... I've tried

 

[self.tableViewModel reloadBoundValues];

        [self.tableViewModel.tableView reloadData];

 

But no luck - the info is there - just no displayed until the user goes back - back - then forward...

 

John

 

Attached File  Screenshot 2015-08-31 22.23.07.png   309.6K   17 downloads



#9 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 01 September 2015 - 07:49 AM

This problem does not exist in the sample I attached above. Are you sure you're updating your intermediate view UILabels in 'viewWillAppear'? 



#10 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 01 September 2015 - 12:38 PM

Yes - of course.

 

Me Bad...

 

I had that code in viewDidLoad not viewWillAppear - knowing full well it has to updated at every presentation... can you please change my status from "Experienced Member" to "Dummy"

 

John



#11 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 01 September 2015 - 01:42 PM

I've done worse, believe me :)


  • Dave Guerin and wizgod like this

#12 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 17 September 2015 - 07:54 PM

Note:

 

Using my model above, I was able to display my thumbnail image this way...

 

// Show Thumbnail Image of Plant

    

    NSString *imageString = (NSString *)[self.tableViewModel.masterBoundObject valueForKey:@"thumbnail"];

    NSString *fullName = [NSString stringWithFormat:@"Documents/%@", imageString];

    NSString *imagePath = [NSHomeDirectory() stringByAppendingPathComponent:fullName];

    UIImage *thumbnail = [UIImage imageWithContentsOfFile:imagePath];

    mainImageView.image = thumbnail;

 

If this helps someone... please feel free to use...

 

John






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users