JQueryMobile: Custom icons - jquery-mobile

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

Related

Button with icon on Apple Watch

I'm creating an App for Apple Watch which has a menu with two buttons like the Instagram App does. I'm wondering how you can put an Image file and text inside one button.
(It's not two separate objects as both image and text grey out when you click it.)
The only thing I can think of is that the icon and text were created as an image file and used as the background image of the button. Could there be another way?
Add a group element and in the Layout property choose Overlap
now all objects in the group are stacked

How to add custom color in Xcode storyboard color picker?

I am planning to make theme color of UI elements in application.
how we show custom color(Golden Color) like Black color in picker menu
is it possible? like we can add custom Property as shown in snapshot
You can add custom color as folow
Select color property(Background color, text color, etc.). A popup is shown from that select "other" option.
A color picker will be opened. Here you can set your custom color by RGB/Hex Code and you can set opacity.
The color will be applied and visible under "Recently Used Colors". This is how you can add custom colors but as far as I know you can't add colors in that default list.
Create a new palette by clicking "New" here:
A new palette "Unnamed" will be created. You can rename that palette by clicking the cog again and choosing "Rename..." Then, you'll need to click on the objects you want to capture the color of, and drag the color of those objects into the color chip area:
Once you've captured the color, you can even rename it something that indicates where it's normally used, providing more information to the recipient than just the color.
source
As of Xcode 9 you can add colors to your asset catalog.
Open your asset catalog, click the + and add a color set.
Click on the color that was created and you can name it and set the color using the inspector.
Thereafter that color shows up in storyboard color chooses in the area called Named Colors.
To achieve this follow these steps
*) In the Project navigator, select the asset catalog, click the Add button (+) at the bottom. In the pop-up menu, choose the type of asset set to create
*) then you'll see the color asset on storyboard.
Cheers :)

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).

How to add control to the TRzToolbar

I have add TRzToolbar to the form. I want it to look like as shown in figure below.
I want to add control as shown in figure to the TRzToolbar..I right clicked TRzToolbar component on the form selected edit toolbar which bring in Toolbar editor with stock images as shown below.
In stock images it is not showing control like checkbox,drop down and radio button etc as shown in first figure. How to add these control to TRzToolbar?
The Toolbar Editor can only handle Toolbuttons. Instead using the editor, simply drop the desired control from the tool palette onto the Toolbar in the form designer.

How to create the screen in optimized way?

Hello everybody I am trying to create a screen (to see the image click here)
I have set it's backround image also created required list components which are click able by extending Field class. Now my problem is I am not able to set that rounded white color as backround of the list. Please help me. And also because I am new to the blackberry please also tell me the optimized way to create this screen.
i think like this
1) header bar - create manager and embed 2 buttons and 1 label in it
2) bottom bar - create a global class that contains the buttons and define a method that responds to the click event of these buttons
call that class in this main screen
3) for middle part use a list field which is scrollable

Resources