UA-17470720-3

Jump to content


Photo
- - - - -

Disable all STV split view specific behaviour?


  • Please log in to reply
20 replies to this topic

#1 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 04 January 2016 - 12:37 PM

Hi,

Is it possible to somehow instruct STV not to detect that it is in a splitview?

 

I have a few Parse and CoreData controllers that work perfectly except when they are placed(pushed via show detail seque from a fixed menu in the master section) inside the detail part of a split view - then they do not show any data.

 

I assume that's due to STV doing some specific things to it's model because it is in a spltiview?

 

Halldor


Edited by halldorg, 04 January 2016 - 12:38 PM.


#2 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 04 January 2016 - 02:39 PM

you can use STV anyway you wish..

If your referring to STV in a split view when you first create a new project, then that is just a base/standard display.. you can delete it and create what ever you want

Check out some of the sample apps in the STV framework folder


  • Morten Jacobsen likes this

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


#3 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 04 January 2016 - 03:04 PM

I have no problem using STV in a standard splitview controller but for some reason a perfectly working SCTableViewController with Parse or CoreData bindings does not show any data(or any sections at all) when it is put into the detail view controller of a splitview.

 

My suspicion is that there is some feature of STV to detect when it is in a splitview controller and alters it's behaviour such as that it i.e. makes the detailvc of the splitview the default vc for the models detail view.....

 

If I change the same seque to show the STV modally(same STV) it shows the data and works as it should.  Making the same STV the initial VC of the StoryBoard and not using the splitview has the same effect, the STV works perfectly.

 

It has so far worked in all situations except when it is pushed as show detail to the detail of a splitview.

 



#4 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 04 January 2016 - 03:14 PM

ok.. i will create a test and see what happens :)


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


#5 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 04 January 2016 - 03:58 PM

yup there is lots of built in STV code that is detecting splitview controllers and what in the detail view etc and taking control of it

 

however this might be what you need to use to work.. when you select the cell control what the custom view you want to show

 

detailViewController

Action gets called to give you the chance to return a custom detail view controller for the cell.

@property (nonatomic, copy) SCCellDetailViewControllerAction_Block detailViewController
Return Value
The custom view controller. Must only be of type SCViewController or SCTableViewController. Note: returning nil ignores the implementation of this action.

Example:

// Objective-C
cellActions.detailViewController = ^UIViewController*(SCTableViewCell *cell, NSIndexPath *indexPath)
{
    MyCustomViewController *customVC = [[MyCustomViewController alloc] initWithNib:@"MyCustomViewController" bundle:nil];

    return customVC;
};

// Swift
cellActions.detailViewController =
{
    (cell, indexPath)->UIViewController in

    let customVC = MyCustomViewController(nibName: "MyCustomViewController", bundle: nil)

    return customVC
}
Discussion
This action is typically used to provide your own custom detail view controller, instead of the one automatically generated by the cell.

Edited by ozie, 04 January 2016 - 04:01 PM.

  • halldorg likes this

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


#6 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 04 January 2016 - 04:19 PM

Thanks ozie :)

 

I don't think that's what I am looking for - my problem is not really with the "Detail" view of the STV but the Master/main part of the STV which does not show any data when it is placed inside the SplitView Detail view.

 

I am using the "Master" part of the SplitView to select which STV will be shown in the "Detail" controller and doing so via a static table and Show Detail Seques

 

This method works with other tableviewcontrollers but STV seems to assume that because it's inside a SplitView it has to behave in a specific way - I was hoping there were some simple overrides that I could do to prevent this from happening and STV to behave as it does when it is not inside a SplitView.

 

I have a lot of settings and lookup tables that I store in Parse and was hoping to have one splitview where I could select the table to work with on the left and have STV take care of all the data stuff on the right - seemed a very good idea until I realised that STV does not work as expected inside the detail part of a splitview.

 

Anyway, thanks for taking a look.

 

Halldor

 

 

yup there is lots of built in STV code that is detecting splitview controllers and what in the detail view etc and taking control of it

 

however this might be what you need to use to work.. when you select the cell control what the custom view you want to show

 

detailViewController

Action gets called to give you the chance to return a custom detail view controller for the cell.

@property (nonatomic, copy) SCCellDetailViewControllerAction_Block detailViewController
Return Value
The custom view controller. Must only be of type SCViewController or SCTableViewController. Note: returning nil ignores the implementation of this action.

Example:

// Objective-C
cellActions.detailViewController = ^UIViewController*(SCTableViewCell *cell, NSIndexPath *indexPath)
{
    MyCustomViewController *customVC = [[MyCustomViewController alloc] initWithNib:@"MyCustomViewController" bundle:nil];

    return customVC;
};

// Swift
cellActions.detailViewController =
{
    (cell, indexPath)->UIViewController in

    let customVC = MyCustomViewController(nibName: "MyCustomViewController", bundle: nil)

    return customVC
}
Discussion
This action is typically used to provide your own custom detail view controller, instead of the one automatically generated by the cell.

Edited by halldorg, 04 January 2016 - 04:23 PM.


#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 January 2016 - 09:21 AM

Hi Halldor,

 

If I correctly understand what you want, then you simply need to set your tableViewModel.detailViewController to nil in your RootViewController.

 

// RootViewController.m

- (void)viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];

  self.tableViewModel.detailViewController = nil;
}

 

 

Please let me know if this achieves what you want.



#8 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 05 January 2016 - 10:45 AM

Hi Tarek,

NO - it has nothing to do with the detailviewcontroller of the tableviewmodel.

 

The Tableviewmodel itself, it's main view controller is a SPLITVIEW DETAIL view controller, - I am displaying the MAIN STV in the SPLITVIEW Detail view.

 

The same STV works perfectly if I display it modally instead of on the detail but once it is in the detail it refuses work and shows no data.

 

 

Halldor



#9 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 06 January 2016 - 08:21 AM

Hi Halldor,

 

The only way STV "detects" a UISplitViewController is by automatically assigning 'detailViewController' on your behalf. There shouldn't be any other differences, and STV should be working as expected inside the detail view of the split controller. I'd be glad to look at a sample if you can upload one.



#10 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 06 January 2016 - 09:30 AM

I think ozie already sent you a sample where he reproduced the behaviour.

 

H



#11 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 06 January 2016 - 09:52 AM

Hi Tarek,

You can just take the Core Data sample application from the STV sample folder.

 

Then disconnect the Master and Detail relationships.

 

Create a standard tableviewcontroller and put a static content there - make it the MASTER of the the SplitView

 

Now make the STV the Detail of the Splitview and run.

 

The detail view of the Splitview is just gray - STV is not shown.

 

Now if I create another tableviewcontroller(not stv) and make that the detail and run it shows there normally.

 

I can upload this modified sample but this is really easy to reproduce - STV does not seem to like being in the detail of a splitview.

 

Hi Halldor,

 

The only way STV "detects" a UISplitViewController is by automatically assigning 'detailViewController' on your behalf. There shouldn't be any other differences, and STV should be working as expected inside the detail view of the split controller. I'd be glad to look at a sample if you can upload one.


Edited by halldorg, 06 January 2016 - 09:53 AM.


#12 halldorg

halldorg

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 26 posts
Reputation: 5
Good

Posted 10 January 2016 - 04:33 PM

Hi Tarek,

Any update on this?

 

Halldor



#13 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 12 January 2016 - 02:14 PM

Update- This is the workaround I gave Halldor during the site blackout: Call '[self addStaticContentToModel]' in the view controller connected to the UISplitViewController detail.

 

- (void)viewDidLoad
{
  [super viewDidLoad];

  [self addStaticContentToModel];
}

  • halldorg likes this

#14 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 12 January 2016 - 08:25 PM

addStaticContentToModel?? where does this come from?


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


#15 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 13 January 2016 - 06:51 AM

@ozie: Just noticed it's missing from docs! Will fix, thank you!



#16 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 13 January 2016 - 03:11 PM

I didn't check the docs.. I just typed it into Xcode and nothing showed as a workable property


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


#17 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 13 January 2016 - 03:21 PM

It's actually a method, not a property.



#18 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 13 January 2016 - 03:25 PM

It's actually a method, not a property.

 

thats what i meant


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


#19 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 13 January 2016 - 03:28 PM

no method there

 

Attached File  Screen Shot 2016-01-14 at 9.28.09 AM.png   35.4K   4 downloads


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


#20 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 14 January 2016 - 02:55 AM

It looks like addStaticContentToModel is a method on SCTableViewController, it's certainly there in the STV code. And it autocompletes for me, although I can't seem to take a screenshot of it doing that.


Cheers,

Dave

www.dgapps.ie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users