Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WatchKit Interface controller scrolls too much after adding next page segue

experts!

Today started to build Apple Watch version for my CelebrateMore! app and can't solve one issue. I have 2 interface controllers - Page-based kind. As soon as I set segue to "next page" from first to second, my first interface controller starts to scroll much more than before.

Screenshot from Storyboard: Screenshot from Storyboard:

Screenshot from simulator during scrolling:

Scrolling issue

Screenshot from simulator if I remove next page segue and scroll:

enter image description here

Already from scrollbar it can be seen, that there is a lot of empty content if "next page" is used. Does anyone has some idea, how to solve this, how to avoid "the long after content scrolling" issue?

like image 255
valdistt Avatar asked Jan 08 '23 18:01

valdistt


2 Answers

I've struggled with the same issue for several hours until I decided to give it up for a while and focus on filling the labels with actual data at runtime. After I added some code to the main initialisation methods of WKInterfaceController ((void)awakeWithContext:(id)context {} and/or (void)willActivate {} ), this scrolling issue magically disappeared. Try to set the text of one or all the labels in your interface in code in one of the 2 methods mentioned above and see if the scrolling problem gets fixed:

[self.label setText:@"Some text.."];

It worked in my case.

like image 109
Bogdan Grigorescu Avatar answered Jan 17 '23 21:01

Bogdan Grigorescu


Due to low reputation I cannot upvote: The solution of setting the text of a label worked for me too. I set an empty text first, then load the data and update the label there again once the request is successful. It works and calculates the height of the scroll view correctly.

override func awakeWithContext(context: AnyObject?) {
    super.awakeWithContext(context)

    //enable correct scroll height
    self.titleLabel.setText("")

    self.loadData()
}
like image 31
helkarli Avatar answered Jan 17 '23 20:01

helkarli