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

在 UIScrollView 上顯示大 UIView 的最佳方式是什么

What is the best way to show large UIView on UIScrollView?(在 UIScrollView 上顯示大 UIView 的最佳方式是什么?)
本文介紹了在 UIScrollView 上顯示大 UIView 的最佳方式是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個大的 UIView.它的大小可變.它可能大于 5000x5000 size.我使用 UIBezierPath 在其上繪制線條、圓圈.我還在上面添加了一些 view.這些 subview 中的每一個都包含 buttonstextviewlabels 等.

I have an large UIView. Its variable size. It may be larger than 5000x5000 size. I draw lines, circles on it using UIBezierPath. Also I add some view's on it. Each of these subview's contains buttons, textview, labels, etc.

我把這個主視圖放在 UIScrollView 上.UIScrollViewzoomable 并且必須非常清晰地顯示內容(它不應該變得模糊).

I placed this main view on UIScrollView. UIScrollView is zoomable and have to show the contents very sharply (It should not get blurred).

目前,我繪制完整的 UIView 并添加到 UIScrollView.問題是,由于內存壓力問題,它占用了太多的memory崩潰.

Currently, I draw complete UIView and added on UIScrollView. The problem is that, Its taking too much memory and crashing because of Memory Pressure Issue.

我應該如何處理以實現高性能?

How should I handle this to achieve high performance?

推薦答案

繼承UIView并在其中實現+layerClass方法:

Subclass UIView and implement the +layerClass method in it:

+layerClass
{
    return [CATiledLayer class];
}

這會導致您的視圖由 CATiledLayer 而不是單個巨大的 CALayer 支持(在該大小下會消耗太多內存).

This causes your view to be backed by CATiledLayer instead of a single, huge CALayer (which would consume too much memory at that size).

然后,您只需在自定義視圖類中實現 -(void)drawRect:(CGRect)rect 并在其中完成所有繪圖.我最近在我的項目中必須這樣做,該項目使用 UIScrollViews 滾動一個可以達到 10000 x 150000 的區域.

Then you just implement -(void)drawRect:(CGRect)rect in your custom view class and do all of your drawing in there. I had to do this recently in my project which uses UIScrollViews to scroll over an area that can be as big as 10000 x 150000.

這篇關于在 UIScrollView 上顯示大 UIView 的最佳方式是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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 可縮放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中縮放和捏合)
主站蜘蛛池模板: 黄在线免费观看 | 久久国产精品偷 | 色综合99 | 欧美 日本 国产 | 极品久久 | 日韩在线播放第一页 | 欧美亚洲国产一区二区三区 | 综合久久久 | 欧美日韩三级视频 | 中文字幕在线播放第一页 | 国内精品免费久久久久软件老师 | 日韩1区| 成年女人免费v片 | 日韩中文字幕在线播放 | 欧美人妇做爰xxxⅹ性高电影 | 黄色免费网站在线看 | 国产yw851.c免费观看网站 | 欧美国产日韩一区二区三区 | 成人免费视频网站在线观看 | 四虎影院免费在线 | 中文在线视频 | 色婷婷综合久久久久中文一区二区 | 日本aaa视频| 欧美日高清 | 影视先锋av资源噜噜 | 国产区在线观看 | 国产精品成人一区二区三区 | 久草网站 | 网站国产 | 亚洲精品大全 | 久久久久久高潮国产精品视 | xxxxxx国产| 羞羞视频免费在线 | 久久久久国产一区二区三区四区 | 成人不卡视频 | av成年人网站 | 欧美精品乱码久久久久久按摩 | 成人亚洲片 | 国产成人精品一区二 | 操操日 | 中文字幕亚洲免费 |