Changing Button Title from Storyboard don't reflect changes - ios

I am facing a weird problem i.e:
My Button title is not what i mentioned in storyboard after build.The Button is getting title from other button near to it.
What i tried already is:
I have verified that Object ID of both button are different.
I clean the project and built again.
I Uninstalled the app and from simulator and tried again.
I restarted the Xcode and checked again.
And Also from code i am not changing title of any button infect no ref# or outlet in code.
If i remove the title from storyboard and Run it reflect the change and show empty title there! that is Normal behaviour, But when i put any other title it show nearest element title not own.
Also if i set title from Controller [self.basicInfo setTitle:#"Basic Info" forState:UIControlStateNormal];it change the text and solves the issue.
But My Point is why it is behaving like this and where is the problem.
I have Attached the image file where you can see that in storyboard it show text "Basic information" but after running it shows HOW TO BUY.

Your problem is related to the fact that you have your storyboard localized, so you need to search in your (StoryBoardName.string) the Label object id ie: "YR7-n7-RFZ.text" = "testText"; and change the value after equal sign
here you have an tutorial about this topic
https://medium.com/lean-localization/ios-localization-tutorial-938231f9f881

Related

Setting button image also ends up adding the word "button" to image; how to fix

So I made some assets in sketch and have successfully imported them into Xcode. When I attempt to give a button the image of one of these assets, Xcode does just that, but it also ends up adding the word "button" next to my image (seen in picture). I have a feeling my settings in the inspector could be the culprit, however playing around with them has yielded no victory.
Would you be able to recommend any solution?
Thanks]1
Remove the Button title "Button" from the inspector.
If you want button title and background image then assign your image into Background field which is below Image field and if you don't want button title then assign that image in Image field and remove title Button.
See the picture. By default it will take the title as Button. delete it. This will resolve your issue.

iOS get UINavigationBar's back button in order to set accessibility properties

I have a navigation controller stack where one of the views has a dynamic title.
The view controllers and their titles go like this:
Main --> ItemsTableView --> ItemDetails
Title:Main Title: NN Items Title: Details
Because the iOS UINavigationController sets the text of the "Back" button to be the title of the previous screen, the "Back" button on the details screen says "< NN Items" where NN is a dynamically changing number.
I'm trying to do some iOS UI automation, but the accessibility Label / ID of the back button is set by the system to it's button text. This means that the accessibility label of the back button on the details screen will change dynamically, and I can't find it from my scripts!
If I could get a reference to the UIBarButtonItem then I could easily set it's accessibilityLabel or accessibilityIdentifier from code to be a fixed string, however I can't figure out how to do this?
All of the stuff I've been able to find references setting the back button to a custom button via self.navigationItem.backBarButtonItem or similar, but when I read this property it's nil. I haven't been able to find out how to get access to the standard item without replacing it. I'd prefer not to replace the button if possible
This was bugging me as well. I've been writing Xcode 7 UI Tests and was trying to come up with a generic way of tapping on the back button without having to replace it with a custom button.
The following is how I solved this for Xcode 7 UI Tests - but you may also be able to apply this to UI Automation as well.
I discovered that (in terms of Xcode 7 UI Tests at least) the back bar button item that is created by the system consists of two buttons the entire thing is a button with an accessibility label of whatever the title of the button is, and then the arrow is also a button with an accessibility label of "Back".
Thus, as long as there aren't any other buttons on the screen that are identified as "Back", the back button can be accessed via the accessibility label of "Back". Like so in the case of UI Tests:
[[app.buttons matchingIdentifier:#"Back"] elementBoundByIndex:0]
Here I'm getting the first button that can be identified by "Back". I my case there could only ever be two such buttons - the arrow, or the whole back button itself (in the case where the back button's title is also "Back"). Since both of these buttons are essentially the same, just getting the first one it finds is sufficient.

Handling Button states

Hello I have another problem/question. I have a custom control with a button on it:
I want to delete an image from it, so I removed the reference from Attributes inspector -> Image, so now my button in designer looks like this:
But when I launch it on simulator, when I press the button (just push it, not making a click ) the image shows up! Where does it come from? Are there any button states styles in project files, where this could be written?
Because button has two references - 1 outlet and 1 action and none of those are used to add image to the button! I just don't understand where from the image gets in...
You should remove the image for both normal and selected states of the button from the attribute inspector(check stateConfig attribute).

Can't find field to check or set UIButton tag--Xcode 5.0

I've got a number of buttons in a view and have assigned a tag number to each for identification in code. I just went back to check one of them, and can't find the field in the Attributes Inspector where I originally assigned the tags. I've tried all my buttons and restarted Xcode, and the result is the same--no tag field.
Here's what my attribute inspector looks like with a (tagged) button selected in the storyboard:
I came upon a recent comment by someone who also couldn't locate the tag field. He also is using Xcode 5.0.2.
Anybody else run into this?
Thanks!
The sections in the attributes inspector can be shown or hidden by clicking on the lines where the words "View", "Control", etc appear. When you rollover the line with these section titles, you'll see the words "show" or "hide" appear on the right edge of the line. Clicking anywhere on the line toggles between the two states.
Where it says view: Move your mouse over to the far right and something should appear that says "Show". Click on it and you'll see the tag identifiers, etc.

Highlighted property is only for display within Interface Builder

How do I solve such warning? What does it mean in most of the cases?
When I click on it, there is nothing highlighted on my Interface Builder (it just zooms in on some area between 2 view controllers).
You have a UIImageView with Highlighted set to true in Xcode. Xcode tells you that the value is for WYSIWYG but won't work at runtime.
After looking at warning message details I got to know, but still there was no way, I could find particular Image is having highlighted="YES"
Perfect Trick suggested by #Keller in Accepted answer's comment.
Just right click your Storyboard --> Open As --> Source Code.
search for
highlighted="YES
Just set YES to NO.
or event if you look carefully code around searched string, you can get in which ViewController's Scene particular ImageView.
Thanks to #Keller
Right click on your Storyboard -> Open as -> Source Code.
Search for highlighted = "YES".
Check the name of the image.
Find the image on the Storyboard.
Click the image, go to Show the Attributes inspector.
Uncheck the Highlighted option
Highlighted image

Resources