UIPageControl
1.表示頁數(shù)
2.表示當(dāng)前正處于第幾頁
3.點(diǎn)擊切換頁數(shù)
屬性的簡單用法
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(10, [UIScreen mainScreen].bounds.size.height - 40, 300, 20)];
pageControl.tag = 100;
//設(shè)置表示的頁數(shù)
pageControl.numberOfPages = 6;
//設(shè)置選中的頁數(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)容頁的大小
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ū)域相對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能否滑動
scrollView.scrollEnabled = NO;
//隱藏水平滑動指示器
scrollView.showsHorizontalScrollIndicator = NO;
//隱藏垂直滑動指示器
scrollView.showsVerticalScrollIndicator = NO;
//關(guān)閉滑動時的回彈效果
scrollView.bounces = NO;
//設(shè)置當(dāng)點(diǎn)擊狀態(tài)條時,scrollView 能否滑到最頂端 (YES滑到最頂端)
scrollView.scrollsToTop = YES;
//設(shè)置scrollView是否可以整屏滑動(一次滑動整個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
//如果想讓視圖滑動.內(nèi)容頁的大小必須要比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í)是多個button的組合視圖,通過切換不同的segment(嚴(yán)格的說點(diǎn)擊不同的button)響應(yīng)不同的操作.
基本屬性
//UISegmentedControl 是iOS中的分段控件,其實(shí)是多個button的組合視圖,通過切換不同的segment(嚴(yán)格來說,點(diǎn)擊不同的button)響應(yīng)不同的操作
NSArray *titles = @[@"輕拍", @"長按", @"輕掃", @"平移"];
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元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
文章標(biāo)題:IOS里的重要控件-創(chuàng)新互聯(lián)
網(wǎng)頁路徑:http://chinadenli.net/article0/ddgeio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、面包屑導(dǎo)航、搜索引擎優(yōu)化、定制網(wǎng)站、品牌網(wǎng)站設(shè)計、軟件開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容