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

將標題視圖添加到類似于 Safari 和文章的 UIWebVi

Adding a header view to a UIWebView similar to Safari and Articles(將標題視圖添加到類似于 Safari 和文章的 UIWebView)
本文介紹了將標題視圖添加到類似于 Safari 和文章的 UIWebView的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想向 UIWebView 添加一個標題視圖,類似于 MobileSafari 中的地址/搜索欄和 Sophia Teutschler 的優秀 Articles.app.更準確地說,我想在 UIWebView 上方創建一個拉動固定方向"視圖,就像在文章中一樣.文章確實使用了 UIWebView,所以這似乎是可能的.如 這篇文章?顯然,我確實需要滾動事件以使拉動以固定方向"行為相應.

I'd like to add a header view to an UIWebView similar to the address/search bar in MobileSafari and the excellent Articles.app by Sophia Teutschler. More precisely, I'd like to create a "pull to fix orientation" view above a UIWebView, just like in Articles. Articles does use a UIWebView, so it seems to be possible. Is there a way to accomplish this without having to embed the UIWebView into a UIScrollView and updating its size all the time, as described in this article? Apparently, I do need the scrolling events to have the "pull to fix orientation" behave accordingly.

推薦答案

經過幾次嘗試,我決定采用這個解決方案:

After several attemps, I've decided to go with this solution:

基本上我剛剛將我的標題 UIView 添加為 webview.scrollview 子視圖.

Basically I've just added my header UIView as a webview.scrollview subview.

為避免標題與瀏覽器視圖重疊:

To avoid having the header overlap the browser view:

  • 循環瀏覽所有 [webview.scrollView 子視圖]
  • 尋找最大的,應該包含瀏覽器(其他用于陰影和線條)
  • 改變它的起源.y

  • cycle through all [webview.scrollView subviews]
  • look for the biggest, wich should contains the browser (the others are for shadows and lines)
  • change its origin.y

代碼如下:

CGRect browserCanvas = web.bounds;
for(int i=0; i< [[web.scrollView subviews] count]; i++)
{
  UIView* subview = [[web.scrollView subviews] objectAtIndex:i];
  CGRect f = subview.frame;
  NSLog(@"sub %d -> x:%.0f, y:%.0f, w:%.0f, h:%.0f", i, f.origin.x, f.origin.y, f.size.width, f.size.height);

  if(f.origin.x == browserCanvas.origin.x && 
     f.origin.y == browserCanvas.origin.y && 
     f.size.width == browserCanvas.size.width && 
     f.size.height == browserCanvas.size.height)
     {
         f.origin.y = header.frame.size.height;
         subview.frame = f;
     }
}

if(![header superview])
{
  [web.scrollView addSubview:header];
  [web.scrollView bringSubviewToFront:header];
}

這篇關于將標題視圖添加到類似于 Safari 和文章的 UIWebView的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

get index or tag value from imageview tap gesture(從 imageview 點擊手勢獲取索引或標簽值)
UIScrollView not scrolling regardless of large contentSize(無論內容大小如何,UIScrollView 都不會滾動)
Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉轉換)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創建圖像)
How to auto scroll UIScrollView using timer?(如何使用計時器自動滾動 UIScrollView?)
Programmatically force a UIScrollView to stop scrolling, for sharing a table view with multiple data sources(以編程方式強制 UIScrollView 停止滾動,以便與多個數據源共享表格視圖) - IT屋-程序員軟件開發技術分享
主站蜘蛛池模板: 欧美大片18 | 黄色国产片 | 波多野结衣一区二区 | 日韩免费在线 | 亚洲久草 | 性久久 | 小镇姑娘国语版在线观看免费 | 8x8ⅹ国产精品一区二区 | 玖玖伊人 | 懂色av懂色av粉嫩av | 在线观看日韩精品 | 91在线一区二区 | 亚洲欧美乱综合图片区小说区 | 日韩一级免费视频 | 91精品国产成人www | 天天看片天天爽 | 成年人视频网站 | 久久久网 | www.青青草.com | 成人激情综合网 | 精品日韩在线观看 | 国产香蕉视频在线观看 | 日产久久视频 | 在线免费观看av网站 | 国产欧美久久久 | 麻豆成人免费视频 | 成人午夜在线视频 | 日韩福利在线 | 久久黄色影院 | 中文在线观看免费视频 | 少妇高潮久久久久久潘金莲 | 国产黄a三级三级三级看三级男男 | 老女人性生活视频 | 欧美日韩亚洲天堂 | av一区二区在线观看 | www.日韩精品 | 亚洲一区二区三区四区在线 | 中文在线观看免费视频 | 在线观看黄色小说 | 亚洲成人免费观看 | 黄色三级av |