Apple watch circular buttons - ios

How to design circular buttons in Apple watch? What would be the approach to design a screen like the contacts application of the watch.

I don't know if this is what you want, but you could try this:
-open your Graphic/Design-Application (Photoshop, Gimp or whatever)
-create a circle-button and save the image
-in Xcode, drag a button into your interface
-go to the attributes inspector of the button and set your image at background > image

You can achieve this using group,
Drag group object and drop it in interface builder
set equal height and width to the group
In attribute inspector, set custom radius to half of the height value set.For Eg: if height and width is set as 30, then the radius will be 15. This will give you round shape.
Add color or image based on the need
Add tap gesture to the group and add action to the gesture. Handle stuffs here that are needed to be handled on clicking it

Please, find my answer for your query. I hope that it will help you more.
If you want to design a screen like favorite contact app on apple-watch, then the WWDC video link given in my answer will definitely guide you.
I have designed app with a circular menu which is not exactly same as the apple's favorite app, But it has almost have a circular view with statically.
For that, I have used Groups in horizontal layout for each horizontal item with proper alignment of inside groups.

Related

How do I measure the distance between UI elements in Xcode?

I'm trying to determine the distance between UI elements in my app, to check that the layout matches that specified by designers. I'm using the 'Debug UI Hierarchy' option, and I do see the representation of the phone's UI in Xcode. However, the only way I can see to determine the relative positioning of two elements is to look at the Size inspector in the right sidebar, and do a manual calculation on their provided measurements. Is there a better way to do this? Can I select one element and then select another to compare it with?
I now its been a while since you asked your question but I've faced the same problem and I could figure out how to measure NSConstraints between views in runtime.
First, you have to click the debug view hierarchy icon on the debug area as shown on this picture:
After pressing the button a snapshot of the Views hierarchy will be shown on the Xcode screen as follows:
You can see all the elements (UIViews) that are actually being displayed (or not, they can be in the background) on the screen of the device
After this, you can press on the show constraint icon to show the constrains that are being applied to every view on the screen, you'll have a screen pretty similar to the interface builder constraint layout:
If you select on a particular constraint (the one you actually care about), i.e in this screen I want to know the distance between the top and the ImageView that is being represented by the big square. So selecting on that particular constraint and clicking on the inspector Object inspector icon inside the Utilities panel you can actually see the constraint description.
This way you can see the constraints measures and the relation with the views and frame bounds.
You can press "Option key" and the UI element on StoryBoard this will show distances between this element and any other
I hope this helps

How can I style a text field in iOS (Swift)?

I am a beginner and just started learning iOS. I want to achieve this layout, using Swift:
When you drag a text field into your project, there's a number of styling options available in the Utilities bar in Xcode, that can help you style the shape, colour and other properties of your field. To achieve the look you want, you could use something like this:
Place a UITextField and a UIButton on your story board. Then select both items, and then go to Editor, Embed In, stack view. If they are one on top of the other, change the stack view orientation to vertical then they will be side by side as shown above. Next change the attributes of both in the attributes inspector to taste. You can change the attributes manually in code using textField.defaultTextAttrubutes = [ "the look you are going for"], but you should need to in order to recreate your example.
you can add a view container to your view, inside that container .. add a button and a textfield then add positioning constraints on them.
as you can see in the picture .. it illustrates the idea .. you can style it the way you want e.g. change the height of your textfield .. change its border style etc. the same with your button.
example
In order to add a border, you have to enter some specific information in the attributes inspector. Here is a snapshot of what you can use to create border radius if you want one, vary the thickness of the border, and select a color for the border. screenshot of attributes inspectorYou can vary the values to make the radius greater and the width thicker also, plus you can change the color. Pay very close attention to the spelling otherwise this won't work.

What are the best practices in building user interface with Xcode?

I am designing a simple user interface for an app using Xcode and Auto Layout. I have a view controller with three basic outlets: a static image view, a label and a button. You can see it in the picture shown below.
As you can see, I'd like to have the image view horizontally and vertically centered in the view controller, the label just below it and the button somewhere in between the label and the Bottom Layout Guide.
The problem is that I am experiencing some appearance problem with the iPhone 6 I am using for testing. The interface items are not nicely centered as they are supposed to be, as you can see from this screenshot.
I am not asking for the solution to this problem, though. I would rather know whether there are best practices to design a good user interface. For example, is there some way to temporarily hide the label and the button from the view controller to focus only on the debugging of the image view without having to remove and redesign them again?
Select the label you want to hide,then uncheck the checkbox installed
You can simply set its alpha to zero .

StoryBoard Different screen sizes iOS

I'm trying to make an app. I prepared the ui with sketch app.And I export the ui , it is like this:
I add some text field and button to View
But when I use Auto Layout and constraints buttons and text fields are going to another place.I need the use them like in the picture.What should I do ? Do you have any suggestion ?
Thank You
Notice the red arrow at the top right of your second screen shot. That is telling you that your constraints are faulty. Until you fix them, you will not see your interface widgets in the desired locations.
In general, as long as you see a red or yellow arrow in that spot, you need to work on your layout some more. Do not attempt to run a project when Interface Builder shows you that red or yellow arrow; your results will be disappointing, to say the least.

Segmented controls in iWatch

I would like to create a control for Apple Watch (using WatchKit) that resembles the iPhone UISegmentedControl.
Has anyone managed to achieve this on Apple Watch already?
I followed the suggestion of a user and used buttons and custom background colours to achieve this. However the issue I got now is that they do not align horizontally. Any way to do so?
Place your buttons in group with horizontal layout, make their widths relative to container with 0.5 value. Also you can set zero cornerRadius for buttons.
Just add your controls into WKInterfaceGroup,set its layout to Horizontal and tweak controls width in Interface Builder.Set spacing explicitly to 0 to override default value(2 pts).Here is the screenshot that illustrates the result.
You can group your buttons as Vladimir described if you really want to create a segmented control. However, if you do, you should probably use a shorter label than "Standby" for the third option, so that your tap targets can all have a consistent size.
Also, you might consider reworking your UI in such a way that you can eliminate the third option, be more explicit about what you're controlling, and use built-in controls with larger targets. For example, would something like this be possible?

Resources