最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iOS自定義選擇框代碼分享

 更新時間:2017年03月16日 11:47:48   作者:弦外雨  
這篇文章主要為大家分享了iOS自定義選擇框的實(shí)現(xiàn)代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iOS自定義選擇框的具體代碼,供大家參考,具體內(nèi)容如下

效果圖:

工程圖:

代碼:

RootViewController.h

#import <UIKit/UIKit.h>
#import "CYCustomMultiSelectPickerView.h"

 
@interface RootViewController : UIViewController
<CYCustomMultiSelectPickerViewDelegate>
{
 CYCustomMultiSelectPickerView *multiPickerView;
 UILabel *pickLabel;
}

@end

RootViewController.m

#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
 if (self) {
  // Custom initialization
 }
 return self;
}

- (void)viewDidLoad
{
 [super viewDidLoad];
 // Do any additional setup after loading the view.
 
 
 self.title=@"ALPickerView";
 
 pickLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 50)];
 pickLabel.backgroundColor=[UIColor orangeColor];
 pickLabel.textAlignment=NSTextAlignmentCenter;
 [self.view addSubview:pickLabel];
}
//隨意點(diǎn)擊任意處,彈出選擇框
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
 [self initPickerView];
}
-(void)initPickerView
{
 for (UIView *view in self.view.subviews) {
  if ([view isKindOfClass:[CYCustomMultiSelectPickerView class]]) {
   [view removeFromSuperview];
  }
 }
 
 multiPickerView = [[CYCustomMultiSelectPickerView alloc] initWithFrame:CGRectMake(0,[UIScreen mainScreen].bounds.size.height - 260-20, 320, 260+44)];
 multiPickerView.backgroundColor = [UIColor clearColor];
 multiPickerView.entriesArray = [NSMutableArray arrayWithObjects:@"one",@"two",@"three",@"four",@"five",@"six",@"seven", nil];
 multiPickerView.entriesSelectedArray = [NSMutableArray arrayWithObject:@"one"];
 multiPickerView.multiPickerDelegate = self;
 
 [self.view addSubview:multiPickerView];
 [multiPickerView pickerShow];

}
#pragma -mark -picker delegate
//點(diǎn)擊確定要執(zhí)行的操作
-(void)returnChoosedPickerString:(NSMutableArray *)selectedEntriesArr
{
 NSLog(@"returnChoosedPickerString");
 
 NSMutableArray* newArray = [NSMutableArray array];
 
 for (NSString* str in selectedEntriesArr) {
  
  [newArray addObject:str];
 }
 NSString *endStr = [newArray componentsJoinedByString:@","];
 
 pickLabel.text=endStr;
 
}

- (void)didReceiveMemoryWarning
{
 [super didReceiveMemoryWarning];
 // Dispose of any resources that can be recreated.
}


@end

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:

相關(guān)文章

最新評論

同仁县| 叶城县| 越西县| 绿春县| 麦盖提县| 庄河市| 清徐县| 宁强县| 荣成市| 乌兰察布市| 长泰县| 芮城县| 崇义县| 炎陵县| 晴隆县| 澳门| 祁阳县| 勃利县| 临邑县| 梁山县| 井冈山市| 隆安县| 湖北省| 阳谷县| 大余县| 祁门县| 大城县| 庆城县| 岚皋县| 普安县| 禹城市| 昌都县| 夏津县| 井陉县| 楚雄市| 太和县| 荔波县| 马鞍山市| 红河县| 富阳市| 衡阳市|