新聞中心
UIPageControl
1.表示頁(yè)數(shù)
2.表示當(dāng)前正處于第幾頁(yè)
3.點(diǎn)擊切換頁(yè)數(shù)
屬性的簡(jiǎn)單用法
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(10, [UIScreen mainScreen].bounds.size.height - 40, 300, 20)];
pageControl.tag = 100;
//設(shè)置表示的頁(yè)數(shù)
pageControl.numberOfPages = 6;
//設(shè)置選中的頁(yè)數(shù)
pageControl.currentPage = 0;
//設(shè)置未選中點(diǎn)的顏色
pageControl.pageIndicatorTintColor = [UIColor grayColor];
//設(shè)置選中點(diǎn)的顏色
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
//添加響應(yīng)事件
[pageControl addTarget:self action:@selector(handlePageControl:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:pageControl];
[pageControl release];
UIScrollView
基本用法:
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(20, 20, 280, 440)];
//設(shè)置內(nèi)容頁(yè)的大小
scrollView.contentSize = CGSizeMake(280, 440);
scrollView.tag = 200;
//設(shè)置內(nèi)容區(qū)域的偏移量, (修改scrollView左上角的點(diǎn)距離自身坐標(biāo)系坐標(biāo)原點(diǎn)的位置,修改bounds的origin)
//內(nèi)容區(qū)域相對(duì)frame上下左右從哪顯示
scrollView.contentInset = UIEdgeInsetsMake(100, 100, 0, 0);
scrollView.contentOffset = CGPointMake(200, 0);
[scrollView setContentOffset:CGPointMake(200, 0) animated:YES];
scrollView.backgroundColor = [UIColor whiteColor];
//設(shè)置scrollView能否滑動(dòng)
scrollView.scrollEnabled = NO;
//隱藏水平滑動(dòng)指示器
scrollView.showsHorizontalScrollIndicator = NO;
//隱藏垂直滑動(dòng)指示器
scrollView.showsVerticalScrollIndicator = NO;
//關(guān)閉滑動(dòng)時(shí)的回彈效果
scrollView.bounces = NO;
//設(shè)置當(dāng)點(diǎn)擊狀態(tài)條時(shí),scrollView 能否滑到最頂端 (YES滑到最頂端)
scrollView.scrollsToTop = YES;
//設(shè)置scrollView是否可以整屏滑動(dòng)(一次滑動(dòng)整個(gè)scrollView的大小)
scrollView.pagingEnabled = YES;
//scrollView 的代理
scrollView.delegate = self;
//設(shè)置大縮放比例
scrollView.maximumZoomScale = 4.0;
//設(shè)置最小縮放比例
scrollView.minimumZoomScale = 1.0;
[self.view addSubview:scrollView];
//scrollView 上添加p_w_picpathView
//如果想讓視圖滑動(dòng).內(nèi)容頁(yè)的大小必須要比scrollView的大小要大,
UIImageView *p_w_picpathView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height)];
p_w_picpathView.p_w_picpath = [UIImage p_w_picpathNamed:@"4.JPG"];
p_w_picpathView.tag = 100;
[scrollView addSubview:p_w_picpathView];
[p_w_picpathView release];
[scrollView release];
UISegmentedControl 是iOS中的分段控件,其實(shí)是多個(gè)button的組合視圖,通過(guò)切換不同的segment(嚴(yán)格的說(shuō)點(diǎn)擊不同的button)響應(yīng)不同的操作.
基本屬性
//UISegmentedControl 是iOS中的分段控件,其實(shí)是多個(gè)button的組合視圖,通過(guò)切換不同的segment(嚴(yán)格來(lái)說(shuō),點(diǎn)擊不同的button)響應(yīng)不同的操作
NSArray *titles = @[@"輕拍", @"長(zhǎng)按", @"輕掃", @"平移"];
UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:titles];
//設(shè)置默認(rèn)選中的分段
segmentControl.selectedSegmentIndex = 0;
segmentControl.frame = CGRectMake(10, 40, 300, 30);
//給segmentControl添加響應(yīng)事件
[segmentControl addTarget:self action:@selector(handleSegmentControl:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:segmentControl];
[segmentControl release];
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)頁(yè)題目:IOS里的重要控件-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://www.ef60e0e.cn/article/ddgeio.html