![](/img/trans.png)
[英]Which delegate method will get fired in UITextfield or UITextview?
[英]webview delegate method is not fired in background process
我正在開發一個應用程序,因為我正在使用我的靜態庫。然后使用以下代碼在后台運行該應用程序
-(IBAction)sendKeyValuePair:(id)sender
{
[NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil];
}
-(void)startTheBackgroundJob
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//create the object for library class and do something and release that object.
[pool release];
}
然后,我在該庫類中創建了一個webview對象,並將該webview添加到我的主類中,如下所示
web=[[UIWebView alloc]init];
//web.delegate=self;
web.frame=CGRectMake(1, 1, 100,100);
[web loadHTMLString:html_str baseURL:nil];
[main_View.view addSubview:web];
[html_str release];
[web release];
在這里我的問題是如果我將委托設置為self則應用崩潰了;如果我沒有設置委托則不會觸發。並且委托方法僅在庫類中實現。我想將委托設置為self並運行在類中委托方法的方法。
加上這個
[web setDelegate:Your library class name instance];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.