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

滾動視圖 iphone 周圍的陰影或邊框

Shadow or Border around a scrollview iphone(滾動視圖 iphone 周圍的陰影或邊框)
本文介紹了滾動視圖 iphone 周圍的陰影或邊框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想在 uiscrollview 周圍繪制邊框/陰影,我知道我可以通過額外的視圖或滾動視圖到達那里,但不喜歡處理缺點,但我聽說應該有可能直接繪制邊框到滾動視圖,這就是我想要的.

i would like to draw a border / shadow around a uiscrollview, i know that i could get there with an additional view or scrollview but dont like the handling an drawbacks but i heard that there should be a possibility to dirctly draw a border to a scrollview and that is what i would prefer.

我是 iphone 開發的新手,任何答案都會有所幫助.

I am quiet new to iphone developement,any answer would helpful.

推薦答案

如果您使用滾動視圖(或任何 UIView)的 layer 屬性,您可以輕松獲得實心邊框...

If you use the layer property of your scroll view (or any UIView) you can easily get a solid border...

#import <QuartzCore/QuartzCore.h>
...
myView.layer.borderWidth = 2;
myView.layer.borderColor = [UIColor blackColor].CGColor;

您也可以通過設置 layer.shadow* 屬性來使用圖層來應用實時陰影,但是使用此技術可能會降低性能,因此我通常更喜歡使用以下更復雜的方法,但更高效的技術.您可以創建一個中間透明、邊緣有陰影的 PNG 圖像 - 它需要有 9 個不同的區域:每個角 4 個,每個邊緣 4 個,中間有一個完全透明的 1x1 像素區域.例如,如果您的陰影在圖像中延伸 6 個像素,則您的圖像將是 13x13,具有 6 像素寬/高邊框和 1x1 區域在中間.然后使用以下方法將其設置為可縮放圖像:

You can also use the layer to apply real-time shadows by setting the layer.shadow* properties, but performance can be slow with this technique, so I generally prefer to use the following more complex, but more performant technique. You can create a PNG image with transparency in the middle and shadows around the edge - it needs to have 9 distinct areas: 4 for each corner, 4 for each edge, and a completely transparent 1x1 pixel area in the middle. For example if your shadow extends 6 pixels into your image, your image would be 13x13 with the 6 pixel wide/high borders and the 1x1 area in the middle. Then you set it as a scalable image using:

newImage = [image stretchableImageWithLeftCapWidth:6 topCapHeight:6];

更新: 由于 iOS 5.0 stretchableImageWithLeftCapWidth:topCapHeight: 已棄用,因此僅當您仍想支持 iOS 4.x 設備時才使用此功能.如果您只想支持 iOS 5.0+ 設備,請改用:

UPDATE: Since iOS 5.0 stretchableImageWithLeftCapWidth:topCapHeight: is deprecated so only use this if you still want to support iOS 4.x devices. If you want to support only iOS 5.0+ devices use this instead:

newImage = [image resizableImageWithCapInsets:UIEdgeInsetsMake(6, 6, 6, 6)];

然后將圖像放在父視圖上,這樣它就占據了滾動視圖的整個區域.如果您希望陰影覆蓋您的可滾動元素,(因此您的滾動視圖看起來嵌入/位于頁面的其余部分之后)然后在頂部放置一個透明的 UIView 并在其上放置陰影圖像,以便它顯示到您的滾動視圖在它后面.

Then you put the image on the parent view so it takes up the entire area of the scroll view. If you want the shadows to go OVER your scrollable elements, (so your scroll view looks inset/behind the rest of the page) then place a transparent UIView over the top with the shadow image on it so that it shows through to your scroll view behind it.

這篇關于滾動視圖 iphone 周圍的陰影或邊框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設置滾動視圖內容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 欧美成人高清视频 | 日韩在线免费视频 | 欧美日韩精品中文字幕 | 一区二区三区四区在线视频 | 国产男人的天堂 | 在线一区二区国产 | 久久99精品久久久久婷婷 | 国产精品久久久久无码av | 伊人网站| 成人欧美一区二区三区在线播放 | 夜久久 | 亚洲网站在线观看 | 亚洲精品欧美 | 欧美成人精品激情在线观看 | 日本一区二区三区在线观看 | 北条麻妃99精品青青久久主播 | 欧美黄色片在线观看 | 成人免费淫片aa视频免费 | 欧美a级成人淫片免费看 | www.天天操 | 精品一区二区三区在线观看 | 国产粉嫩尤物极品99综合精品 | 国产欧美日韩在线一区 | 精品福利一区 | 欧美精品91| 成人小视频在线免费观看 | 成人在线视频免费播放 | 99久久日韩精品免费热麻豆美女 | 亚洲综合精品 | 日本久久网 | 91麻豆久久久 | 日韩视频精品在线 | 欧美日韩精品一区二区三区蜜桃 | 国产97久久 | 中文字幕亚洲区 | 久久精品一区 | 国产亚洲成av人片在线观看桃 | 国产一二三区免费视频 | 日韩精品不卡 | 粉嫩av| 午夜国产精品视频 |