zoukankan      html  css  js  c++  java
  • ios 导航栏 点击barbutton的按钮 下拉列表

    环境: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


  • 相关阅读:
    xamarin 安卓输出中文错误 乱码解决
    xamarin自定义 application 无法调试
    Xamarin中 ios 修改Assets.xcassets 文件后 无法调试和编译
    xamarin 编译出现Xamarin.Build.Forms.Tasks.GetTaskAbi 无法加载的错误解决方法
    13、最新安卓Xamarin绑定相关填坑之旅
    12、xamarin form中实现H5 网页唤醒微信支付的方法
    11、使用xamarin实现全屏播放rtmp之类的直播视频
    8.在XamarinAndroid上进一步控制包的大小
    Xamarin.Forms 中iOS通过URL Scheme判断应用是否安装
    Xamarin.Android 使用PopupMenu遇到的问题
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/6908528.html
Copyright © 2011-2022 走看看