I've seen many posts about how to change the "Delete" texts that appears on the right when editing an UITableView.
But what I need to do is to change the image that appears on the left when a UITableViewCell is editable.
I've tried with editingAccessoryView property, but it appears on the right as the normal accesoryView.
Is it possible to change the left delete (-) icon?
You cannot change the (-) icon, however, you can implement your own editing style.
Check UITableView's setEditing:animated: method where you can make your editing style on the cell
Directly we can not change it but if you want then you can customize it. See the below link which help you:
Customized Demo Code: https://github.com/teameh/TableViewCustomEditControls
To change the color theme only: http://www.cumulations.com/blogs/11/How-to-customize-UITableViews-editing-mode
Related
I have an app that allows the user to edit a UITextView, however the copy/paste/cut bar pops on the iPad, blocking some of the bottom of the interface, as the following screenshot shows:
I would prefer getting rid of it instead of adjusting the interface, is there any way to accomplish this?
NOTE: This only appears on the iPad!
EDIT: My UITextView is entirely editable, therefore, this is not a duplicate of How disable Copy, Cut, Select, Select All in UITextView ! Also, I don't want to just disable the buttons, I want the whole bottom bar to go away!
EDIT 2: Updated the image for more clarity, as some answers are addressing the small black one that appears near the cursor.
You can hide this as below,
yourTextView.inputAssistantItem.leadingBarButtonGroups = []
yourTextView.inputAssistantItem.trailingBarButtonGroups = []
I've made an app (for iOS) that shows a ListView with product information on it.
On the left of the row, I have a button to add the product to the orderlist. However when I click the button, the entire row changes color. I don't want this, I want the row to stay the same when it is clicked.
I've tried to set the allowSelection property to 'false', but then the 'itemclick' event doesn't fire anymore, so that's not the solution.
I also tried to set the selectedBackgroundColor property to 'transparent', but this still changed the color of the row when the button is clicked.
Is there any easy solution to this? Thanks.
Use "selectionStyle" property of the cell class, example shown below,
cell.selectionStyle = .none
By this usage the selection will occur but it wont change the color on highlighting(selecting state) of the cell.
When you highlight text in iOS, a menu is shown giving options such as cut and copy, it floats above the text and is black. What is this called and how can i implement it in a tableview (to give options when a row is selected)
You mean this, this is a UIMenuController
https://developer.apple.com/library/ios/documentation/iPhone/Reference/UIMenuController_Class/
another bit of info:
http://nshipster.com/uimenucontroller/
How to use it:
https://www.captechconsulting.com/blogs/getting-started-with-uimenucontroller-in-ios-5
An actual example already coded up for you:
https://github.com/jszumski/uimenucontroller-example
It is called UIMenuController.
This menu is referred to as the editing menu. When you make this menu visible, UIMenuController positions it relative to a target rectangle on the screen; this rectangle usually defines a selection. The menu appears above the target rectangle or, if there is not enough space for it, below it.
You can also provide your own menu items via the menuItems property. When you modify the menu items, you can use the update method to force the menu to update its display.
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
I am building a custom UITableViewCell which will be displayed while the user is downloading data from a web service, and which will include a "Cancel" button to allow them to cancel the URL connection. I'd like to emulate the look-and-feel of the "Delete" buttons which are displayed in the table editing view, like this:
How can I create such a red button which says "Cancel" instead of "Delete" in my custom UITableViewCell? It appears that the only type of button I can put in a UITableViewCell is a regular UIButton (UIBarButtonItem won't go anywhere except a UIToolbar), and Interface Builder doesn't give an option to create a red Delete-like button as a standard style.
In the end, I just had to create my own custom UITableViewCell, and use some Photoshop magic to figure out how to make a button that looks exactly like the iPhone Delete buttons, but saying "Cancel." It didn't take that much time.