Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 8, 2009, 12:26 AM   #1
iphonejudy
macrumors 6502
 
Join Date: Sep 2008
Adding a button in the tableview.

Hi,

I want to add button in tableview.

In the design time i cannot add button in tableview.Can i add it in the coding?

If so, how?
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Apr 8, 2009, 04:43 AM   #2
johnnyjibbs
macrumors 68030
 
johnnyjibbs's Avatar
 
Join Date: Sep 2003
Location: London, UK
Send a message via AIM to johnnyjibbs Send a message via MSN to johnnyjibbs
Coding is your friend - Interface Builder will be of no use here.

Probably best to subclass UITableViewCell and add a button as a subview during cell initialisation, but you don't have to subclass.

If you don't want to subclass, you can initialise the button somewhere within the cellForRowAtIndexPath method (I normally create the tableView:dequeueCellWithIdentifier: and configureCell:atIndexPath: methods as in some of the Apple examples). The key thing is to add the button as a subview of the cell's content view in a similar way to how you would add a custom label:

Code:
[cell.contentView addSubview:myButton]
There are several good examples that illustrate this (e.g. UITableView examples 1-5 or perhaps CustomCell).

Don't forget to release your button instance once you have added it as a subview as the parent view (in this case the cell's content view) retains its subviews at the point you add them.

Hope that gives you a starting point.
johnnyjibbs is offline   0 Reply With Quote
Old Apr 8, 2009, 06:44 AM   #3
iphonejudy
Thread Starter
macrumors 6502
 
Join Date: Sep 2008
thanks
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Apr 9, 2009, 08:07 AM   #4
iphonejudy
Thread Starter
macrumors 6502
 
Join Date: Sep 2008
Actualy i placed the tableview control in my view , and i want to add the button in the last cell of tableview

How can i addit?
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Apr 9, 2009, 09:37 AM   #5
caveman_uk
Guest
 
caveman_uk's Avatar
 
Join Date: Feb 2003
Location: Hitchin, Herts, UK
Do you need a button in a cell or a button as a cell? If the second then you could create a button and set it as the tableview's footer view. You will have to do this in code as I don't think you can do it in IB.
caveman_uk is offline   0 Reply With Quote
Old Apr 11, 2009, 01:39 AM   #6
iphonejudy
Thread Starter
macrumors 6502
 
Join Date: Sep 2008
Quote:
Originally Posted by caveman_uk View Post
Do you need a button in a cell or a button as a cell? If the second then you could create a button and set it as the tableview's footer view. You will have to do this in code as I don't think you can do it in IB.

i want to add button in the 6th cell of the tableview
__________________
Judy
iphonejudy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
in Xcode 4, where can I find the "class" button in the Library window? wayneljw iPhone/iPad Programming 2 Aug 11, 2011 12:52 AM
Missing Tracks from iTunes in the Cloud AndrewLGP Mac Applications and Mac App Store 3 Jun 19, 2011 03:16 PM
Is there a keyboard shortcut for the button in the top right corner of the Finder? illjazz Mac Basics and Help 4 Jan 6, 2010 07:08 PM
Anyone else wish the send button in the messages app was bigger? Bacong iPhone 10 Jul 6, 2009 04:48 AM
The "Tic-Tac" button in the Finder & Icon sizes Karvel OS X 1 Aug 15, 2007 09:18 PM


All times are GMT -5. The time now is 05:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC