UA-17470720-3

Jump to content


Photo
- - - - -

DetailViewController cells too narrow

cells view-controllers

  • Please log in to reply
6 replies to this topic

#1 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 11 December 2015 - 11:55 AM

Hi 

 

I have an SCArrayOfObjectsModel bound to a core data store, showing a list of "folder names"

When the user starts searching I customPresent a detailModel viewcontroller that shows the matching "files" from all "folders":

 

self.folderTableModel.sectionActions.customPresentDetailModel = ^(SCTableViewSection *section, SCTableViewModel *detailModel, NSIndexPath *indexPath) {

     [self.navigationController pushViewController:detailModel.viewController animated:NO];

};

 

- (void)textFieldTextDidChange:(UITextField *)textField {

   ...   

   SCArrayOfObjectsSection *section = (SCArrayOfObjectsSection*)[self.folderTableModel sectionAtIndex:0];

   [section dispatchEventSelectRowAtIndexPath:nil];

   ...

}

 

This worked fine in STV3. But in STV5pro the contentView of the cells in the detailviewcontroller are too narrow (see image).

 

I don't understand why. All views use autolayout. I am not manually touching any frames. I have not changed this part of the code going from STV3 to 5.

 

Dennis

 

 

Attached Files



#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 11 December 2015 - 02:58 PM

Hi Dennis,

 

This is really strange, especially that the accessory button is also indented. This looks as if the whole UITableView has shrunk!

 

I couldn't replicate this at all using the code you provided, is there any sample you could attach for me to have a look at?



#3 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 11 December 2015 - 03:51 PM

Hi Tarek

 

Thanks for the quick reply. Always on the job ;-)

 

It is not the whole tableview that has shrunk: see image when the cell is tapped: the cells background is full width. 

 

I wish I could easily send you a project to replicate, but I would have to extract it from a large codebase. 

I am now working around this by readjusting subview sizes in cellActions.didLayoutSubviews... far from ideal. 

 

The default cell size is 320x44 -> on iPhone this issue does not appear...

 

What would be a good entrypoint to provide a different default cell size before the tableviewsection is layed out?

 

Dennis

Attached Files



#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 13 December 2015 - 06:30 AM

You're most welcome Dennis :-)

 

All this sounds really weird. Is this a custom cell created in an IB storyboard or Xib file? If so, then please attach that. It will be very hard for us to diagnose this without some hints on how to replicate (or preferably a sample of course).



#5 Dave Guerin

Dave Guerin

    Forum Master

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

Posted 14 December 2015 - 02:09 AM

Hi Tarek and Dennis,

 

Dennis, I guess that as well as jumping from STV 3 to STV 5 you're also jumping from iOS 6  or 7 (?) to iOS 9.

 

The insets you're seeing are a new "feature" in iOS 9:

 

https://developer.ap...leContentGuideĀ 

 

https://developer.ap...owReadableWidth

 

 

So on iPad in landscape iOS has decided that your cells would read better if they were narrower. Setting cellLayoutMarginsFollowReadableWidth to NO and you'll get the layout you are expecting.

 

 

 

HTH.


  • Tarek and wizgod like this
Cheers,

Dave

www.dgapps.ie

#6 Dennis

Dennis

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 23 posts
Reputation: 4
Good

Posted 14 December 2015 - 02:38 AM

Hi Dave

 

 

> I guess that as well as jumping from STV 3 to STV 5 you're also jumping from iOS 6  or 7 (?) to iOS 9.

 

yes, from supporting iOS7 / 8 to iOS 8 / 9

 

 

> Setting cellLayoutMarginsFollowReadableWidth to NO and you'll get the layout you are expecting.

 

Indeed! Fantastic.

 

 

> HTH

 

If this means "hope that helps", the anwser is

 

Y!

 

Dennis


  • Dave Guerin likes this

#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 14 December 2015 - 05:29 AM

Thank you Dave, that was spot on! Me thinking it was a bug took me in a completely wrong direction, so I think you just saved us tons of time :-)


  • Dave Guerin likes this





Also tagged with one or more of these keywords: cells, view-controllers

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users