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).
Related
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.
Is there an option for a button/image to set, that it will always be shown on top? So I have 2 buttons and want to add an image. But the image covers the two buttons and I have no idea how I could get the image in the background or the buttons in the front.
BTW: I´m fairly new to xcode and programming...
Use the xCode top menu item Editor->Arrange. There you have options to handle z index for controls.
What I did was, to have two button one for the label and one for the image and when one is clicked it propagates the message to the other and does the action depending on which one was clicked.
I am trying to set the toggle state of a UIButton through the interface builder. I have done it successfully using code, but I need to get it working through the interface builder.
Im not sure what the issue is but for selected I set its image to 'flashOn' and for disabled I set it to 'flashOff'
When I hold down the image, it shows the 2nd image, but pressing the image does not toggle between these two images.
Im certain it's super simple so if you can suggest what I am missing I would appreciate it
A button's selected and disabled states need to be set in code.
Can you show your implementation for when you got desired results through code? I think, from what I can piece together from your question, that you have mixed up the states of the button.
Default - images will display for this button in any state unless another is specified explicitely
Disabled - image will display when button is disabled. (button will not switch from this state through user interaction as it is disabled)
Selected - image will display when the button is selected, which as far as I know is only when you set the button as selected through code.
Highlighted - image will display when you press and hold down on the button
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.
I created a custom icon, when I assign it to a hard-coded list the custom icon shows. but when I place it to a programmatically added list in a table it doesn't show but instead displays the "plus" icon.
ironically when I try the "delete" built-in icon it properly shows but my custom made icon wont.
these are the scenario:
this is my custom button
$(".ui-icon-customicon").css({'background-image':'url("http://website/mycustomeicon.jpg")','backgroundRepeat':'no-repeat', 'height':'18px', 'width':'18px', 'background-position':'center', 'background-color':'white'});
when I use the above button to a hard-coded list in a Table it properly shows. But when I use it like this...
listItem = document.createElement('li');
listItem.setAttribute("data-icon","customicon");
my icon doesnt show. and instead it displays the "plus" icon. but when I try this....
listItem = document.createElement('li');
listItem.setAttribute("data-icon","delete");
the button changes to the delete (builtin-icon) icon.
Anyone can help me whats the problem? please???
Update
Updating lists
If you add items to a listview, you'll need to call the
refresh() method on it to update the styles and create any nested
lists that are added. For example,
$('ul').listview('refresh');
Custom Icons
To use custom icons, specify a data-icon value that has a unique name
like myapp-email and the button plugin will generate a class by
prefixing ui-icon- to the data-icon value and apply it to the button.
You can then write a CSS rule that targets the ui-icon-myapp-email
class to specify the icon background source. To maintain visual
consistency, create a white icon 18x18 pixels saved as a PNG-8 with
alpha transparency.
Docs:
http://jquerymobile.com/test/docs/buttons/buttons-icons.html