From the UIView subclass into view controller

The original problem from CSDN quiz channels, more solutions.:
Problem description:
Create a view CategoryTableView, inherit from UIView. The CategoryTableView contains a UITableView. I will CategoryTableView as a sub class is added to the HomeViewController, HomeViewController is a subclass of UIViewController. At present, I need the didSelectRowAtIndexPath execution into a new controller. But in the CategoryTableView how to push or display a view controller?

Can't go to the navigation controller in CategoryTableView.

The solution:
CategoryTableView.h
@property (retain, nonatomic) parentViewController *parent; //create one property for parent view like this


CategoryTableView.m
@sythesize parent;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[parent.navigationController . . .]; // preform action
//OR..
[parent presentModalViewController: . . .]; // present modal view
}


parent.m
//while calling your CategoryTableView assign self to your parent object

CategoryTableView *tblView = [CategoryTableView alloc] init];
tblView.parent = self;

Started by Rupert at February 10, 2016 - 9:44 PM

Top up!!!!!

Posted by Morton at February 12, 2016 - 9:54 PM

No idea. . . . . . . . . . . . . . . . . .

Posted by Stephen at February 24, 2016 - 10:14 PM

Make a mark, this useful

Posted by Earl at March 01, 2016 - 10:38 PM

The response to 2013-04-08 16:21:46 was removed by the administrator

Posted by Selina at March 11, 2016 - 10:41 PM

The response to 2013-04-09 09:07:03 was removed by the administrator

Posted by Angelina at March 20, 2016 - 10:53 PM

Do not know what the meaning of~~~~~

Posted by Dana at April 02, 2016 - 11:18 PM

The response to 2013-04-08 16:58:58 was removed by the administrator

Posted by Kyle at April 12, 2016 - 12:14 AM

Nice. It is worth learning

Posted by Brady at April 19, 2016 - 12:24 AM

Good stuff.

Posted by Robin at April 26, 2016 - 1:20 AM

Thank you, support you!

Posted by Verne at May 07, 2016 - 1:48 AM

The response to 2013-04-09 09:10:26 was removed by the administrator

Posted by Jacob at May 11, 2016 - 2:09 AM

The response to 2013-04-09 09:10:26 was removed by the administrator

Posted by Jacob at May 16, 2016 - 2:28 AM

Thank you so much for sharing

Posted by Alvin at May 26, 2016 - 2:30 AM

The response to 2013-04-09 09:48:51 was removed by the administrator

Posted by Joan at June 08, 2016 - 3:21 AM

Don't see understand.........

Posted by Marvin at June 19, 2016 - 4:11 AM

Make a mark, this useful

Posted by Nathan at June 22, 2016 - 4:59 AM

Posted by Miriam at July 07, 2016 - 5:54 AM

Thanks for sharing. . . . . . . . . . .

Posted by Sabrina at July 09, 2016 - 6:12 AM

Nice. It is worth learning

Posted by Warren at July 14, 2016 - 6:58 AM

The response to 2013-04-09 10:00:50 was removed by the administrator

Posted by Gregary at July 20, 2016 - 7:48 AM

Good stuff.

Posted by Angus at August 04, 2016 - 7:59 AM

Well, it is worth learning

Posted by Winnie at August 08, 2016 - 8:29 AM

Thank you so much

Posted by Winnie at August 10, 2016 - 9:11 AM

The response to 2013-04-09 13:27:28 was removed by the administrator

Posted by Melody at August 20, 2016 - 9:44 AM

Make a mark, this useful

Posted by Gillian at August 30, 2016 - 10:05 AM

The response to 2013-04-09 14:33:37 was removed by the administrator

Posted by Lucia at December 12, 2016 - 5:35 PM

PhoenixCard guide V300

Posted by Arno at December 14, 2016 - 5:38 PM

Good stuff on top~~

Posted by Reg at December 24, 2016 - 6:10 PM

The response to 2013-04-09 16:53:48 was removed by the administrator

Posted by Cyril at December 31, 2016 - 6:43 PM

Posted by Cyril at January 01, 2017 - 7:03 PM

The response to 2013-04-09 17:44:39 was removed by the administrator

Posted by Malcolm at January 05, 2017 - 8:47 PM

Although cannot read what it says but you feel very badly.

Posted by Darnell at January 11, 2017 - 7:55 PM

xiexie

Posted by Adolph at January 12, 2017 - 8:14 PM

The response to 2013-04-10 08:57:14 was removed by the administrator

Posted by Murray at January 13, 2017 - 9:26 PM