Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-03-2010, 12:52 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 15
orca is on a distinguished road
Default pushViewController from button help

Hello,

I have an application which has several viewcontrollers contained within it.

A tableViewController has a subclassed UItableView and UItableView cell which is drawn with code. I would like to push a view controller using a button from the custom tablecell.

The tableViewCell didSelectRowAtIndexPath has a different view being pushed. The button in question is in a subView of the Cell.

This is how it is:
Application Delegate
|_
| tableViewController
| |_
| tableView subclass
| |_
| tableViewCell subclass
| |_
| UIButton subView (push ViewController2 from here)
|_
ViewController2

Please Help

Thanks,
Afzal Khan

Last edited by orca; 09-03-2010 at 12:55 PM. Reason: typo
orca is offline   Reply With Quote
Old 09-03-2010, 01:40 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

So it is assumed that you have created a custom UITableViewCell and in it added a button. All you need to do is connect the button to an Action, just like any other button. It is just the code will not be in the TableViewController but in the UITableViewCell instead.

If this isn't a custom cell view and you fulfill the Apple UI Guidelines, then you can use the DetailedDisclosure button as the accessoryType. Then you just override the accessoryButtonTappedForRowWithIndexPath:indexPath method.

Hope that helps.

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html
bytor99999 is offline   Reply With Quote
Old 09-03-2010, 02:01 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 15
orca is on a distinguished road
Default

Thank You for the reply Mark.

This is a custom Cell View. The original tableview's contentView get swiped to reveal another view which contains 4 buttons which perform various actions.

In another viewController, I did the following to push the same viewController in question

Code:
- (void)showContent{
	UIViewController *nextViewController = nil;
	nextViewController = [[ContentViewController alloc] initWithStyle:UITableViewStyleGrouped];
	((ContentViewController *)nextViewController).content = content;
	if (nextViewController) {
        [self.navigationController pushViewController:nextViewController animated:YES];
    }
[nextViewController release];
}
However, from the cell's subview, I can not target that viewController too

when I try:
[self.superview.navigationController pushViewController:nextViewController animated:YES];
It will not work as the superview is a tableview subclass and the actual navigationController is one level above this in the hierarchy

I really am lost how to do this.

Thanks,
Afzal Khan



Quote:
Originally Posted by bytor99999 View Post
So it is assumed that you have created a custom UITableViewCell and in it added a button. All you need to do is connect the button to an Action, just like any other button. It is just the code will not be in the TableViewController but in the UITableViewCell instead.

If this isn't a custom cell view and you fulfill the Apple UI Guidelines, then you can use the DetailedDisclosure button as the accessoryType. Then you just override the accessoryButtonTappedForRowWithIndexPath:indexPath method.

Hope that helps.

Mark
orca is offline   Reply With Quote
Reply

Bookmarks

Tags
pushviewcontroller, uibutton, uitabelviewcell, uitableviewcontroller

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 345
12 members and 333 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, iram91419, linkmx, nadav@webtview.com, Objective Zero, Paul Slocum, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:44 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0