can i use highlighted the table view cell without default blue color in objective c?

I doing a project where i need to use highlighted table view color not default.

-------------Problems Reply------------

Of course you can.

There are two methods to achieve this:

  1. Use UITableViewCell's selectedBackgroundView and selectedTextColor properties
  2. Subclass UITableViewCell and implement the drawInRect and setSelected:animated: methods

The latter option gives you more flexibility and much better performance, but it might be slightly harder if you haven't used CoreGraphics before.

UPDATE In response to the OP's comment:

Here's how you can use the selectedBackgroundView property:

UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
[bgView setBackgroundColor:[UIColor redColor]];
[cell setSelectedBackgroundView:bgView];
[bgView release];

I haven't tried this myself, but it should work.

Try referring to this demo - maybe you could have a look at it and get some help.

Category:iphone Views:1 Time:2009-04-09

Related post

  • How to Change the color of the text present in table view from its default black color in an iphone application? 2010-10-14

    How to Change the color of the text present in table view from its default black color in an iphone application ? --------------Solutions------------- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexP

  • Highlight table view cell on click 2011-10-07

    I place a single table view cell on my view using interface builder and add an accessory type, a selection color and enable user interaction. However when I click on the cell nothing happens. Why isn't the whole cell highlighted, how to achieve this?

  • button inside table view cell shows highlighted state on tapping on cell 2010-04-10

    I have an issue with the background image of button which is dependent of button state. I have a button inside customized table view cell and i have set different images for button's different states. Please look into the code below. [btnNow setImage

  • How to customize the background/border colors of a grouped table view cell? 2008-12-30

    I would like to customize both the background and the border color of a grouped-style UITableView. I was able to customize the background color by using the following: tableView.contentView.backgroundColor = [UIColor greenColor]; But the border color

  • ios - UI table view cell problem 2011-07-12

    This is the first time i am using the accessory view in my app. So i have some problem in that, please help me friends in my app i have placed an accessory view inside an UI Table View Cell. When i swipe over the UI table view cell to delete that row

  • long press gesture on table view cell 2012-02-20

    I want two interactions on a table view cell: normal tap and long press. I used the answer to the following to help me get started: Long press on UITableView The problem with that is if I do a long press on a valid cell, the cell will highlight blue,

  • Table view cell as button 2012-03-02

    I'm trying to set a Table View Cell that has been grouped, as a button however I can't seem to find where to do it in the interface builder in XCode 4.2 or programmatically. I've tried linking the table view cell to an IBAction, however it only lets

  • How do I place a UIWebView in a table view cell and maintain its scroll bars? 2009-01-14

    How can I place a UIWebView in a table view cell, yet maintain the UIWebView's scrollbars? My table view does have multiple cells and a header frame as well, and I do need it to be scrollable because it has many rows. The text displays perfectly fine

  • iPhone: scroll table view cell to visible above custom keyboard-aligned toolbar? 2009-07-12

    I've been asking a question or two over the past few days of working on an application that keeps a custom toolbar aligned to the top of the iPhone keyboard. I'm using the method described by Josh in this question; basically, I have the view controll

  • I put a button on a table view cell that play sound when they are pressed but 2009-08-07

    I put a button on a table view cell that play sound when they are pressed, when I press the button it stop the sound. But pressing another button on another cell it doesn't plays another sound while the other still playing. I hope that when another b

  • Content of custom table view cells not drawing correctly 2009-09-10

    I have several parts in my app where I use custom table view cells. Their content is created with subviews. The problem is that on some of these cells, the content does not appear at all or does not appear correctly until after the cell was selected

  • Open a camera by clicking on the table view cell in iphone app 2010-03-06

    How to open a camera by clicking on the table view cell in an iPhone application? --------------Solutions------------- Use the didSelectRowAtIndexPath method in your table view delegate class. Instantiate a UIImagePickerController to show the camera,

  • map view inside table view cell 2010-03-12

    i have another (probably unanswered) question about map views. I have a map view inside a table view cell and i want to disable the table view scrolling if the scrolling begins in the map view. Also the zooming gesture does not function normally. It

  • Cocoa: getting a Table View cell to send action messages 2010-03-28

    I'm really having trouble getting a Cocoa Table View cell to send action messages. At the most basic level, in IB there is an action assigned for the NSTextViewCell object, and after editing and pressing Return nothing happens. So I have an IBOutlet

  • iPhone Advanced table view cells example 2010-05-07

    I have been going through and re-creating Apple's "Advanced Table View Cells" example to better understand everything. I have done everything, but somehow missed one detail and I can't figure it out. If you launch their example (http://developer.appl

  • How can I keep track of the index path of a button in a table view cell? 2010-05-19

    I have a table view where each cell has a button accessory view. The table is managed by a fetched results controller and is frequently reordered. I want to be able to press one of the buttons and obtain the index path of that button's table view cel

  • Auto height for label or textview within table view cell 2010-06-11

    I have a problem in an iPhone application. Application has a table view controller with custom table view cells. Each cell has a Label (please correct me if I need to use text view etc). I am getting text dynamically from a web service call and I don

  • How to create a Text Field in Grouped Table view Cell in iPhone 2010-06-17

    I want to create a text field in the group table view cell. If i create one text field in a cell, the text fields are over lapped in all the grouped table view cells. I donno how its happened. So i want to create a text field in a grouped table view

  • Code for the expansion and contraction of the table view cell to display the text of a particular cell in iphone? 2010-07-01

    Can any one give me the code for the expansion and contraction of the table view cell to display the text of a particular cell in iphone. --------------Solutions------------- If you want variable heights for your table cells you will need to look int

Copyright (C), All Rights Reserved.

processed in 0.169 (s). 11 q(s)