Theme Color Changing in iOS - ios

I have seen this question asked before however I haven't found a response that seems to work too well.
I am new to Xcode and am trying to make an app for iOS where a user can go into the settings tab and choose a theme such as Red where the buttons, background etc. can change to a certain color. Is there a way to do this by referencing the attributes tab and then telling Xcode to change the button property if the settings button is pressed.
Also if the background is using an image is there a way to change that image with another one if a button is pressed.
I am using Xcode 8.2 and using Swift 3.

Related

How to edit storyboard in Xcode

Every now and then, I see tutorials allowing to add components to a storyboard by clicking a plus sign on the right up corner of the editor:
Bu I do not have this button. And it seems that there is no menu available.
I have to say that I'm trying to modify the storyboard outside of any project by opening the file alone.
Any help appreciated.
The plus button should be available on the right side of Project Header Section[Tool Bar] as Shown in the image
Based on the selected file different screens will be opened when we click on the + button.
We can also use the keyboard shortcut cmd+shift+L
Verified on Xcode Version 14.1 (14B47b)
Update:
As this option is available on the Toolbar, it may not be available if the toolbar itself is hidden. To toggle the visibility of toolbar we can use the shortcut cmd+option+T

Apple Watch Force Touch Menu

I just recently noticed it is possible to add a force touch gesture to my watch app. I've added a Menu and 3 Menu items... as seen here:
Although, when I force touch, the menu does not come up.
Do I need to do something else to get this thing working?
Tutorials suggest I do not. Thus, I turn to stackoverflow.
By default, each menu item's image is set to Custom in the attributes inspector, and without an image asset selected here a menu item won't appear at all upon a firm press. You'll have to choose one of the images that Apple provides in the attributes inspector Image dropdown menu or provide your own asset where it says No Image right below.

iOS bar button icon image sometimes missing

I have weird problem with iOS 8 application: there is a bar button image with some icon.
Problem is that the icon is sometimes shown, but sometimes is missing (but item remains clickable - without any visible appearance, I just know it's there, so I know where to click).
I haven't seen any pattern that would suggest where could be problem, it just disappears and appears randomly.
Anyone had similar problem?
I have the problem in simulator and on device.
Check,
if the name of your image that you put with your button is same with the targeted image files you put in your assets files
Check the view layers. You might put the image button layer under some other view that block your button image

Is there a way/tool/framework to write test automation for individual UI elements on iOS? (whitebox)

I have an application and I want to test individual ui elements in the application from the inside. The purpose is to verify that display controls such as labels are displaying what they should and that touches trigger the correct results.
And I don't mean any E2E tests (I will use Appium for that), I'm looking for something that would allow me to open the app in a state that I need and test one element(if it is displayed correctly and if it behaves correctly - I will probably split these two actions into two separate tests).
For example:
Let's say I have an app that has a "Hello" button in the middle of the screen and upon clicking on that button a new screen opens that has two other buttons. One has label "Red" the other has label "Blue". If I click on "Red" the background of the application turns red and if I click the "Blue" button the background turns blue.
Now I want to write separate tests that would open the app on:
initial screen and check the "Hello" button is there
initial screen and check that clicking on the "Hello" button opens new screen
second screen and check that there is "Red" button
second screen and check that upon clicking on "Red" button the screen turns red
and so on..
I don't know how to call this testing but for me it sounds like "ui unit testing"
I know this is possible on Android using Espresso so I hope it is possible on iOS too.
Have you looked at the new UI Testing tools (XCUITest) in Xcode 7? With it, you would definitely be able to detect the presence of UI elements, and manipulate them (such as tapping on buttons). However, I'm not sure if you'd be able to confirm that the background view's color changed, unless you set the view's UIAccessibility value to include color information.
UI Testing overview: https://developer.apple.com/videos/play/wwdc2015-406/
potential limitations: https://medium.com/#larcus94/ui-testing-with-xcode-7-221d16bad276

Icons for iOS Action Extensions Disappearing After Share Button Menu Disappears

I've been working on a couple of iOS action extensions for a while, but I have noticed an odd behavior I was wondering if anyone else saw. In short, after you install and turn the extension on from the share button menu and leave the menu, it disappears from the menu.
More specifically, when you first install the extension, you expect you have to press the share button, scroll the bottom bar menu (for the action extensions) all the way to the right, press the "More" button, toggle your extension on and then press done. At that point the icon for the extension will appear and you can use it. However, the next time you want to use the action extension, the icon will not appear and you have to repeat the process, even though when you look in the "More" menu, the toggle switches for your app are already flipped on.
I wish I could add images to further elaborate here, but I can't because of StackOverflow's rules.
I have not been able to find any information on this any where, so I was hoping someone here has noticed this behavior or not. Any help on resolving this would be greatly appreciated.
This has been a bug in iOS 8.3, and has been acknowledged by Apple.
Fixed in iOS 9.
Issue on OpenRadar
How to solve:
The new share extension is NOT visible in the default list, and is CHECKED in the “More…” list. Changing any of the switches and tapping Done will show the new share extension in the default list.

Resources