Environment: xocde5.0.2+ios7.0.1
1, navigation bar----Click on the Account--------drop-down list
Code: NGRIGHTTABLEVIEWVIEWCONTROLLER.H
#import <UIKit/UIKit.h>
@protocol pulldownmenudelegate
-(void) menuitemselected: (Nsindexpath *) Indexpath;
-(void) pulldownanimated: (BOOL) Open;
@end
@interface Ngrighttableviewviewcontroller:uitableviewcontroller<uitableviewdatasource,uitableviewdelegate >{
Id<pulldownmenudelegate> pulldelegate;
}
@property (nonatomic, retain) id<pulldownmenudelegate> pulldelegate;
@property (Nonatomic,strong) Nsmutablearray *tableviewarray;
@property (Nonatomic,strong) NSString *cellstring;
-(NSString *) cellstring;
@end
NGViewController.h's Code :
#import <UIKit/UIKit.h>
#import "NGRightTableViewViewController.h"
@interface ngviewcontroller:uiviewcontroller<pulldownmenudelegate>
-(Ibaction) Jumpbut: (ID) sender;
@property (nonatomic, retain) Ngrighttableviewviewcontroller *RTVV;
@end
. M section Code :
-(void) viewdidload
{
[Super Viewdidload];
Additional setup after loading the view, typically from a nib.
Uinavigationcontroller *nav=[[uinavigationcontroller Alloc]initwithrootviewcontroller:viewcontroller];
Marray=[[nsmutablearray alloc] initwithobjects:@ "uuuuuu", @ "Qqqu", @ "QQQQ", @ "rrrr", @ "yyyyy", nil];
UIButton *secondbut=[[uibutton Alloc] Initwithframe:cgrectmake (120, 340, 40, 40)];
[Secondbut Settintcolor:[uicolor Bluecolor];
[Secondbut settitle:@ "second" forstate:uicontrolstatenormal];
[Secondbut Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatenormal];
SecondBut.titleLabel.font = [Uifont fontwithname:@ "System-bold" size:25.0f];
[Secondbut addtarget:self Action: @selector (jumpbut:) forcontrolevents:uicontroleventtouchupinside];
[Self.view addsubview:secondbut];
Uibarbuttonitem *leftbarbtn = [[Uibarbuttonitem alloc] initwithtitle:@ "Touch" style:uibarbuttonitemstylebordered Target: Self action: @selector (leftbarbtnclicked:)];
Self.navigationItem.leftBarButtonItem = leftbarbtn;
Uibarbuttonitem *rightbarbtn = [[Uibarbuttonitem alloc] initwithtitle:@ "account" style:uibarbuttonitemstylebordered target : Self action: @selector (rightbarbtnclicked:)];
Self.navigationItem.rightBarButtonItem = rightbarbtn;
if (Rtvv==nil) {
Rtvv=[[ngrighttableviewviewcontroller alloc] init];
}
Rtvv.tableviewarray=marray;
Rtvv.view.frame=cgrectmake (0, 0, 320, 300);
Rtvv.view.frame=cgrectmake (150, 64, 165, 120);
[Self ADDCHILDVIEWCONTROLLER:RTVV];
[Self.view AddSubview:rtvv.view];
rtvv.pulldelegate=self;
[Rtvv.view Sethidden:yes];
[Self.view PresentedViewController:rtvv.view];
[self: reloaddata];
}
Resources download
In addition: TextField corresponding keywoard of the height of their own active adaptation: http://download.csdn.net/detail/shuang60/7927929
iOS navigation bar Click the Barbutton button drop-down list