你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> ios 導航欄 點擊barbutton的按鈕 下拉列表

ios 導航欄 點擊barbutton的按鈕 下拉列表

編輯:IOS開發綜合

環境:xocde5.0.2+ios7.0.1

1、導航欄 ----點擊科目--------下拉列表

\



<喎?/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+tPrC66O6TkdSaWdodFRhYmxlVmlld1ZpZXdDb250cm9sbGVyLmg8L3A+CjxwPiNpbXBvcnQgPFVJS2l0L1VJS2l0Lmg+PGJyPgpAcHJvdG9jb2wgUHVsbGRvd25NZW51RGVsZWdhdGU8YnI+Ci0odm9pZCltZW51SXRlbVNlbGVjdGVkOihOU0luZGV4UGF0aCAqKWluZGV4UGF0aDs8YnI+Ci0odm9pZClwdWxsRG93bkFuaW1hdGVkOihCT09MKW9wZW47PGJyPgpAZW5kPGJyPgo8YnI+CkBpbnRlcmZhY2UgTkdSaWdodFRhYmxlVmlld1ZpZXdDb250cm9sbGVyIDogVUlUYWJsZVZpZXdDb250cm9sbGVyPFVJVGFibGVWaWV3RGF0YVNvdXJjZSxVSVRhYmxlVmlld0RlbGVnYXRlPns8YnI+CiBpZDxQdWxsZG93bk1lbnVEZWxlZ2F0ZT4gcHVsbGRlbGVnYXRlOzxicj4KPGJyPgp9PGJyPgo8YnI+CkBwcm9wZXJ0eSAobm9uYXRvbWljLCByZXRhaW4pIGlkPFB1bGxkb3duTWVudURlbGVnYXRlPiBwdWxsZGVsZWdhdGU7PGJyPgpAcHJvcGVydHkgKG5vbmF0b21pYyxzdHJvbmcpIE5TTXV0YWJsZUFycmF5ICp0YWJsZVZpZXdBcnJheTs8YnI+CkBwcm9wZXJ0eSAobm9uYXRvbWljLHN0cm9uZykgTlNTdHJpbmcgKmNlbGxTdHJpbmc7PGJyPgo8YnI+Ci0oTlNTdHJpbmcgKikgY2VsbFN0cmluZzs8YnI+CkBlbmQ8YnI+Cjxicj4KTkdWaWV3Q29udHJvbGxlci5otcS0+sLro7o8YnI+CjwvcD4KPHA+I2ltcG9ydCA8VUlLaXQvVUlLaXQuaD48YnI+CiNpbXBvcnQg"NGRightTableViewViewController.h"
@interface NGViewController : UIViewController
//- (IBAction)jumpBut:(id)sender;

@property (nonatomic, retain) NGRightTableViewViewController *rtvv;
@end


.m部分代碼:

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any 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:@"第二" 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:@"觸摸" style:UIBarButtonItemStyleBordered target:self action:@selector(leftBarBtnClicked:)];
self.navigationItem.leftBarButtonItem = leftBarBtn;

UIBarButtonItem *rightBarBtn = [[UIBarButtonItem alloc] initWithTitle:@"科目" 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];

}

另外有:textField對應keywoard的高度自動適應: http://download.csdn.net/detail/shuang60/7927929

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved