ios 導覽列 點擊barbutton的按鈕 下拉式清單

來源:互聯網
上載者:User

標籤:導覽列 下拉式清單

環境:xocde5.0.2+ios7.0.1

1、導覽列 ----點擊科目--------下拉式清單




代碼: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的代碼:

#import <UIKit/UIKit.h>
#import "NGRightTableViewViewController.h"
@interface NGViewController : UIViewController<PulldownMenuDelegate>
//- (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

ios 導覽列 點擊barbutton的按鈕 下拉式清單

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.