Build A Simple iPhone App - Part 4
The next part is about auto layout - size and position etc. This will be useful as already I'm finding that the label is not filling the text well!
Introduction to Auto Layout
So we use mathematical relationships between elements to determine the position/size etc.
Choosing the longest fact (as in the text) and pasting it in ensures that if this fits, they will all fit! Changing the number of lines to 0 ensures it will actually fit in, with some dragging around/changing of size etc. So we are defining constraints, rather than creating external values.....
Adding the constraints makes sense - sub menu at the bottom!
Positioning and Size
This was about positioning the label using several features. The ambiguity issue Pasan had did not come up on mine - maybe due to me having a newer version of Xcode? Anyway, I skimmed over some of this so hopefully will still make sense!
Styling Using Interface Elements
So this is to make it look more jazzy! So adding a background colour is technically using a UI colour class, but actually on Xcode, you don't need to actually code anything - just select! Changing the tint property of a button is to change to another colour used.
Finishing Up Our Layout
So I've changed the background colours, font colours etc. and it looks smart! Next thing is I've created a new label with the title (I've changed Pasan's to F1 Fun Facts, and am basing this mini app around that!). Clicking ctrl and dragging from the top label to the middle one means it will stay that distance apart - another constraint used!
Another point Pasan makes is to see how it looks on other devices. As we're using constraints, it should work on all devices! It's better to use constraints than set pixel values.
Adding a Pop of Colour
So basically, we've created a code using the UI Color class for the background to change colour once the button for a new fact is pressed! The issue is of course that it changes colour once, then stays like this. This needs to be fixed.....
So creating the random number, within the array of colours for the background - made total sense. Was able to pre-empt most of this! Making more sense, linking objects and codes, having the model created first so the View Controller doesn't have too much info in it etc. etc.
Mini disaster though - I've lost the name of the button! Can't find it anywhere so can't do the last bit of the code - matching the name of the text of the button to the same as the background colour changing.
Though I aced the challenges so all good really!
Well that was really productive, gives me so me many ideas for how to actually put code into practice. Bring on the next bit tomorrow!
Introduction to Auto Layout
So we use mathematical relationships between elements to determine the position/size etc.
Choosing the longest fact (as in the text) and pasting it in ensures that if this fits, they will all fit! Changing the number of lines to 0 ensures it will actually fit in, with some dragging around/changing of size etc. So we are defining constraints, rather than creating external values.....
Adding the constraints makes sense - sub menu at the bottom!
Positioning and Size
This was about positioning the label using several features. The ambiguity issue Pasan had did not come up on mine - maybe due to me having a newer version of Xcode? Anyway, I skimmed over some of this so hopefully will still make sense!
Styling Using Interface Elements
So this is to make it look more jazzy! So adding a background colour is technically using a UI colour class, but actually on Xcode, you don't need to actually code anything - just select! Changing the tint property of a button is to change to another colour used.
Finishing Up Our Layout
So I've changed the background colours, font colours etc. and it looks smart! Next thing is I've created a new label with the title (I've changed Pasan's to F1 Fun Facts, and am basing this mini app around that!). Clicking ctrl and dragging from the top label to the middle one means it will stay that distance apart - another constraint used!
Another point Pasan makes is to see how it looks on other devices. As we're using constraints, it should work on all devices! It's better to use constraints than set pixel values.
Adding a Pop of Colour
So basically, we've created a code using the UI Color class for the background to change colour once the button for a new fact is pressed! The issue is of course that it changes colour once, then stays like this. This needs to be fixed.....
So creating the random number, within the array of colours for the background - made total sense. Was able to pre-empt most of this! Making more sense, linking objects and codes, having the model created first so the View Controller doesn't have too much info in it etc. etc.
Mini disaster though - I've lost the name of the button! Can't find it anywhere so can't do the last bit of the code - matching the name of the text of the button to the same as the background colour changing.
Though I aced the challenges so all good really!
Well that was really productive, gives me so me many ideas for how to actually put code into practice. Bring on the next bit tomorrow!
Comments
Post a Comment