久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何以編程方式創(chuàng)建 UIScrollView?

How to create a UIScrollView Programmatically?(如何以編程方式創(chuàng)建 UIScrollView?)
本文介紹了如何以編程方式創(chuàng)建 UIScrollView?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

好的,這里的關(guān)鍵是我根本沒(méi)有使用 IB,因?yàn)槲艺谑褂玫囊晥D是通過(guò)編程方式創(chuàng)建的.UIView 覆蓋了屏幕的下半部分,上面有一堆按鈕.但是,我想在 UIView 中添加更多按鈕,而不使其變得更大.為此,我想在視圖中創(chuàng)建一個(gè) UIScrollView,這將允許我在屏幕外添加更多按鈕,以便用戶可以滾動(dòng)到它們.我認(rèn)為這就是它的工作原理.

Alright, so the key here is I'm not using IB at all, because the View I'm working with is created programmatically. The UIView covers the lower half the screen, and has a bunch of buttons on it. However, I want to add more buttons to the UIView, without making it any larger. To do so, I want to make a UIScrollView inside the view, which will allow me to add more buttons off screen so the user can scroll to them. I think that's how it works.

self.manaView = [[[UIView alloc] initWithFrame:frame] autorelease];
self.manaView.backgroundColor = [UIColor purpleColor];

UIScrollView *scroll = [UIScrollView alloc];
scroll.contentSize = CGSizeMake(320, 400);
scroll.showsHorizontalScrollIndicator = YES;
[self.manaView addSubview:scroll];

代碼的第一部分啟動(dòng)了我的 UIView,效果很好,但我不知道如何以編程方式制作 UIScrollView 并將其添加到視圖中,然后向其中添加按鈕.

The first part of the code iniates my UIView, which works great, but I can't figure out how to make the UIScrollView programmatically and add it to the view, and then add the buttons to it.

UIButton *ret2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
ret2.tag = 102;
ret2.frame = CGRectMake(255, 5, 60, 50);
[ret2 setTitle:@"Return" forState:UIControlStateNormal];
[ret2 addTarget:self action:@selector(flipAction:) forControlEvents:UIControlEventTouchUpInside];
[scroll addSubview:ret2];

當(dāng)我這樣做時(shí),按鈕從我的屏幕上消失了.那么我該如何正確地做到這一點(diǎn)呢?感謝您的幫助!

When I did that, the button simply disappeared off my screen. So How do I do this correctly? Thank you for your help!

推薦答案

代替:

UIScrollView *scroll = [UIScrollView alloc];

執(zhí)行此操作(將框架設(shè)置為您希望滾動(dòng)視圖的大小):

do this (setting the frame to however big you want the scroll view to be):

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:...];

這篇關(guān)于如何以編程方式創(chuàng)建 UIScrollView?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫(kù)中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁(yè)面之間的照片應(yīng)用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動(dòng)時(shí)暫停 NSTimer)
主站蜘蛛池模板: 亚洲国产一区在线 | 天天干狠狠操 | 成在线人视频免费视频 | 国产美女黄色片 | 成人欧美一区二区三区1314 | 欧美一级特黄aaa大片在线观看 | 一区二区国产精品 | av在线一区二区三区 | 在线观看视频h | 久久草视频 | 蜜桃视频在线观看www社区 | 亚洲美女在线一区 | 青青久久 | 精品成人佐山爱一区二区 | 国产一区二区在线看 | 国产精品一区在线观看你懂的 | 欧美精品免费观看二区 | 69精品久久久久久 | 国产精品久久久久久久久久妞妞 | 国产大学生情侣呻吟视频 | 国产精品一区2区 | 在线观看视频一区 | 日本在线看片 | 成人高清视频在线观看 | 成人久久久 | 欧美三区在线观看 | 亚洲成人一区二区三区 | 黄一区二区三区 | 精品久久久久久亚洲精品 | 久久免费精品 | 国产激情精品 | 欧美一a一片一级一片 | 有码在线 | 91麻豆精品国产91久久久久久 | 亚洲一区高清 | 99热这里 | 亚洲日韩中文字幕一区 | 精品国产乱码久久久久久丨区2区 | 亚洲视频在线观看免费 | 天天干天天想 | 欧美日韩看片 |