几种常用控件的使用方法
来源:互联网 发布:如何证明矩阵的分配律 编辑:程序博客网 时间:2024/05/22 09:31
1.UIActivityIndicatorView的使用
UIActivityIndicatorView *activity=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
z[activitysetFrame:CGRectMake(150,150,50, 50)];
[self.windowaddSubview:activity];
[activitystartAnimating];
2. UISlider的使用
UISlider *slider=[[[UISlideralloc]initWithFrame:CGRectMake(100,20,140,20)]autorelease];
slider.maximumValue=10;
slider.value=5;
[slideraddTarget:selfaction:@selector(change:)forControlEvents:UIControlEventTouchUpInside];
[self.windowaddSubview:slider];
-(void)change:(UISlider*)slider
{
NSLog(@"the val is %.2f",slider.value);
}
3.UIPageControl
通常与UIScrollView连用,提示用户当前显示的页数
@property(nonatomic)NSInteger numberOfPages; // default is 0
@property(nonatomic)NSInteger currentPage; // default is 0. value pinned to 0..numberOfPages-1
@property(nonatomic)BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO
sample code:
UIPageControl *pageControl=[[[UIPageControl alloc] initWithFrame:CGRectMake(0, 50, 329, 30)] autorelease]; pageControl.numberOfPages=10; pageControl.currentPage=3; pageControl.backgroundColor=[UIColor grayColor]; [pageControl addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventValueChanged]; [self.window addSubview:pageControl];-(void)clicked:(id)sender{ UIPageControl *pageControl=(UIPageControl*)sender; NSLog(@"curent val is %d",pageControl.currentPage);}
4.UISegmentedControl
NSArray *array=[NSArray arrayWithObjects:@"hello",@"what",@"search",nil]; UISegmentedControl *segmentControl=[[[UISegmentedControl alloc] initWithItems:array] autorelease]; segmentControl.frame=CGRectMake(0, 40, 300, 40); segmentControl.segmentedControlStyle=UISegmentedControlStyleBordered; segmentControl.selectedSegmentIndex=2; [segmentControl addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventValueChanged]; [self.window addSubview:segmentControl];
- 几种常用控件的使用方法
- VB MSFlexGrid控件的几种使用方法
- VB MSFlexGrid控件的几种使用方法
- 常用控件的使用方法
- 常用控件的使用方法
- iOS 常用控件的使用方法
- 常用控件的使用方法-2
- 【Android 开发】:Android中EditText控件的几种使用方法
- Android中EditText控件的几种使用方法
- Android中EditText控件的几种使用方法
- ' * '的几种使用方法
- JSTL1.1的几中常用使用方法
- Android常用控件-DatePicker以及对话框的两种使用方法
- Android常用控件-DatePicker以及对话框的两种使用方法
- Android常用控件的基本使用方法
- UI常用控件的使用方法<UIWidgetTest>
- 05读书笔记之常用控件的使用方法:
- c++几种常用的界面控件的使用1
- 异步 与非阻塞概念
- android中sim卡相关操作
- Gtk+实现非规则按钮的不同状态图片切换
- 试一试csdn
- Linux的僵尸进程解决攻略
- 几种常用控件的使用方法
- Android学习之Activity初步
- Prism学习笔记(一) 从Hello World开始
- Maven使用(1)
- 面试——操作系统的基础知识
- JUnit in Action Second Edition-20130911
- 深度理解依赖注入(Dependence Injection)
- 齐博cms如何调用当前页面伪静态后的地址
- 校园招聘行动中