iOS navigation bar Click the Barbutton button drop-down list

Source: Internet
Author: User
Tags uikit

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.