How can text be placed on upper left corner of Apple Watch screen - apple-watch

I'm using Xcode to develop an Apple Watch app. I would like to place some text on the very upper left portion of the screen, adjacent to where the time is listed.
When I drag a label up to the portion of the screen it auto-aligns down.
I see that most Apple Watch apps have a page title or the app name on the very upper left region of the screen so there must be some way to put text there.
How can text be placed on the very upper left corner of the Xcode screen? So that the text is on the same y axis level as the time.

This is the title of an interface controller, which you can set with setTitle(_:).

Related

Problem putting in MapBox on the right position

I have this mapbox inside on a container which is centered aligned. The thing is whenever I press to show the map, it will show upper left corner of the screen and when I turned off and turn on the screen, the map will eventually out of something put it self at the right position where I wanted to.
Before turning the phone screen off
After turning the phone screen on

Overlay images and customize x,y position in the watchOS storyboard

I want to duplicate this design mockup and use it in production.
iOS has Z-hierarchy for arranging on Z axis, but it's greyed out in watchOS. I want to create an overlay of a profile avatar like this Instagram prototype where only half of the avatar is over the main image.
Naturally I would like all profile images from the server to be placed in the small round imagview which goes on top of the photos in the stream.
Figured it out. It takes some tinkering. The group layout overlap option in the Attribute Inspector works as advertised. My case was unique because I not only wanted an overlay but I also wanted only half of the avatar to overlap as in the Instagram prototype.
Set the group layout overlap attribute to the root group since that has to be done or this to work.
Next apply the overlap attribute to the avatar group since it is the group we want to overlap on top of the cat group.
Use bottom insets on the cat group to push the avatar down. Adjust accordingly. Naturally, if you want a 50% overhang the bottom inset value should be half of the avatar height.
The cat group does not need the overlap attribute.
The circular avatar is not a circular Photoshop element. I simply adjusted the radius of the avatar group to make it round.
Note: You'll get a warning from Xcode when using Overlap.
Interface.storyboard: notice: Discouraged Configuration: Overlap layout falls back to vertical when used before watchOS 4.0

Swift animation/transition like UBER app

Anyone know how the UBER app does the following animation/transition
1) In the main UBER app there is a menu icon with 3 bars in upper left hand corner, when you pan or drag the message view from the bottom (slowly), the menu icon slowly morphs or turns into an up arrow icon and the background slowly turns in to BLACK. Is this done programmatically or is this done for you through the animation library?
This is a custom animation that they do when the user grabs the cards at the bottom of the screen.
They probably draw the menu icon themselves and then using the animation library they morph the lines and rotate everything to look like an up arrow.
Raywenderlich has some good tutorials on animations and their animation book is really good.
https://www.raywenderlich.com/173544/ios-animation-tutorial-getting-started-3

Autolayout and Tableview Headers

I'm trying to recreate the default viewForHeaderInSection only with a button in each header, using autolayout. The crux of my layout is:
#"|-[titleLabel]-4-[refreshButton(==22)]"
This works just fine in both portrait and landscape on my iPhone.
However, when run on an iPad, the 'titleLabel' is too close to the left margin (because the margins are larger on the iPad). I had hoped that |- would use the standard margin to position the label, but it seems not (I guess it just uses a default number of points).
How can I position this label correctly? Do I need to check for iPad vs iPhone and update a constant? Or can I refer to some constant value that represents the margin size?
You should add a new constraint which aligns the left edge of the titleLabel to the left edge of the UITableView. In IB/Storyboard, this is easily done:
Select both objects
Click the alignment button (the first one in this image: )
Click align Left Edges

make a background work on all iphones ios

I've just begun playing around with XCode and currently reading on Objective-C!
I have made a dark background and a book-ish "background" on top of it. Example here.
But how do I set it in a constant position on every iOS device and every iPhone screen-sizes?
From the looks of your image I assume that you want it to be fixed to the bottom.
To do that place your image view in the bottom of its superview and change the autosizing to be fixed to the bottom like in this image below.
The little red box in the view labeled "example" shows you how the image view will behave when the superview is resized.
If you want your image view to have a constant position anywhere else, just position it where you want it and set the appropriate autosizing for it (once again, look at the red box to see how it will behave when resized).
If the right pane is not visible press the right pane button in the tool bar (image below) or use the keyboard shortcut ⌘+⎇+0 to display the right pane or ⌘+⎇+5 to go directly to the size inspector.