UA-17470720-3

Jump to content


Photo
* * * * * 1 votes

first cell hidden by navigation bar...

view-controllers web-services bug

  • Please log in to reply
3 replies to this topic

#1 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 15 March 2014 - 04:42 PM

I've modified the ParseCom App to use a storyboard instead of a .xib.  In my storyboard I have a UINavigationController with a Table View Controller modified to use MyParseViewController for its class.

 

MyParseViewController.h declares it to be an SCTableViewController.

 

MyParseViewController.m has code in viewDidLoad to present the Task Class from Parse with columns/properties of name, description, category and active.  It works - it's possible to add, edit and delete rows in the Task class and see the results in the Data Browser on parse.com.  Also, pull down to refresh works.

 

However, the first Task is displaying underneath the navigation bar.  I believe this starts to happen after using the pull down to refresh.

 

Any suggestions?

 

Code follows...

 

Thanks,

Mark

 

    [super viewDidLoad];
    
    self.navigationBarType = SCNavigationBarTypeAddRightEditLeft;
    
    SCParseComDefinition *taskDef = [SCParseComDefinition definitionWithClassName:@"Task" columnNamesString:@"name;description;category;active" applicationId:@"...KEY REMOVED..." restAPIKey:@"...KEY REMOVED..."];
    SCPropertyDefinition *namePDef = [taskDef propertyDefinitionWithName:@"name"];
    namePDef.required = TRUE;
    SCPropertyDefinition *descPDef = [taskDef propertyDefinitionWithName:@"description"];
    descPDef.type = SCPropertyTypeTextView;
    SCPropertyDefinition *categoryPDef = [taskDef propertyDefinitionWithName:@"category"];
    categoryPDef.type = SCPropertyTypeSelection;
    categoryPDef.attributes = [SCSelectionAttributes attributesWithItems:[NSArray arrayWithObjects:@"Home", @"Work", @"Other", nil] allowMultipleSelection:NO allowNoSelection:NO];
    SCPropertyDefinition *activePDef = [taskDef propertyDefinitionWithName:@"active"];
    activePDef.type = SCPropertyTypeSwitch;
    
    SCArrayOfObjectsSection *objectsSection = [SCArrayOfObjectsSection sectionWithHeaderTitle:nil webServiceDefinition:taskDef batchSize:0];
    objectsSection.dataFetchOptions.sort = TRUE;
    objectsSection.addButtonItem = self.addButton;
    [self.tableViewModel addSection:objectsSection];
    
    self.tableViewModel.enablePullToRefresh = TRUE;


Edited by markr, 15 March 2014 - 04:46 PM.

  • cratrenue likes this

#2 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 15 March 2014 - 05:39 PM

This is really terrific. Thanks Mark. I know I will find this useful. The spacing under the nav. bar is likely an iOS7 issue. There are some workarounds discussed on Stack Overflow.


Edited by David DelMonte, 15 March 2014 - 05:42 PM.

  • markr likes this

#3 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 15 March 2014 - 06:38 PM

its a new iOS7 thing.. but yes i think STV still isn't 100% iOS7 compatible

 

you just need to the set the navigation controller to not extent the edges "Under Top Bars".. this to prevent the tableview from going behind.. if you want the iOS7 effect i think that STV has a set code that doesn't work right with iOS7 in a nav control


  • markr likes this

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


#4 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 15 March 2014 - 09:21 PM

Hi Ozie & David -

 

I combined your responses to stop the problem.  In xCode, I

 

- opened the storyboard

- selected the Navigation Controller

- opened the Attributes Inspector

- in the Simulated Metrics section for Top Bar I changed "Inferred" to "Opaque Navigation Bar" (thanks for the link David)

- in the View Controller Section for Extend Edges I unchecked the check box for "Under Top Bars" (thanks for the pointer Ozie)

 

then rebuild and run in simulator, pull-to-refresh and it no longer slides under the navigation bar after completing the refresh.

 

Thanks,

Mark


  • David DelMonte likes this





Also tagged with one or more of these keywords: view-controllers, web-services, bug

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users