我正在開發一個應用程序,其中我的任務是從我創建滾動視圖並將圖像放在滾動上的數據庫中獲取url-links。
我已經寫了一些代碼,當我點擊圖像時,我必須在webview中顯示url頁面,並將其放在滾動視圖上方。
爲此,我寫了觸摸代碼獲取網址,當我點擊圖像,但我得到的問題,像我的點擊不工作的圖像和滾動視圖也,但它是工作的圖像和scrollview這是一個normalview 。 U可以在下面找到scrollView上的觸摸功能
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch * touch = [[event allTouches] anyObject];
for(int index=0;index<[array count];index++)
{
UIImageView *imgView = [array objectAtIndex:index];
if(CGRectContainsPoint([imgView frame], [touch locationInView:scrollView]))
{
NSString *strgetcontenturl = [[NSString alloc]initWithString:[arrayvideoFile objectAtIndex:index]];
NSURL *url = [NSURL URLWithString:strgetcontenturl];
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:strgetcontenturl]]];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webview loadRequest:requestObj];
}}}
這裏陣列我的觸動代碼是我保存的所有圖像init和arrayvideoFile是我保存所有的URL。
請幫忙。
如何在滾動視圖上添加圖像? –
雅我做@ankityadav – shaan