iphone - Problems with creating and using of delegate-protocols -
I have a problem that I have created a representative protocol, but has not performed the necessary methods, though I Protocol my header Here is a detailed explanation in the file:
I have made an example of my View Controller (Timeline Visual Controller) that will be displayed. This view controller has a UITableView, which in turn receives different cells / rows from an example of my table view cl. So the ViewController creates an example of the tableclass view. Table electricity is a UITextview that includes web links. Now I want the Safari link not open, but my own browser is in the browser. Unfortunately TableViewCell can not open a new ViewController with a WebView, so I see a representative decision-making protocol
The whole thing is like this :.
WebViewTableCellDelegate.h:
@protocolWidgetablesSellelGet - (zero) LoadWeb; @end
Then I created an example WebViewDelegate in TableViewCell:
ID of the & lt; WebViewTableCellDelegate & gt; _Representative;
of the table view table. In:
@ Interface UitextView (override) @ end @ class WebView, webframe; @protocol WebPolicyDecisionListener; @implementation UITextView (defy) - webview (zero): (WebView *) WebView decidePolicyForNavigationAction: (NSDictionary *) actionInformation request: (NSURLRequest *) request frame: (WebFrame *) frame decisionListener: (ID & lt; WebPolicyDecisionListener & gt; ) Listener {NSLog (@ "Request:% @", request); [LoadWebDiGet]; } @end - (minus) setDelegate: (ID & lt; WebViewTableCellDelegate & gt;) Representative implement I & lt protocol {_delegate = representatives;}
And my TimeLineViewController;> and loadWeb- metode:
- (minus) loadWeb {WebViewController * web = [[WebViewController alloc] initWithNibName: zero bundle: nil]; Web.modalTransitionStyle = UimodalTransitionStyleFlipHorizontal; [Self-Present Model View Controller: Web Animated: Yes]; [Web release]; }
And when will be built at the behest of TableViewCell TimelineViewController:
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) Index {Fixed NSString * MyIdentifier = @ "MyIdentifier"; MyIdentifier = @ "tableCell"; Table View Cell * Cell = (Table View Table *) [Tableview DeWewer Re-Eligible CellWithIdentifier: MyIdentifier]; If (cell == blue) {[[NSBindal Main Bundle] LodnIB Nominated: @ "Table Visualcel" owner: Self-choice: zero]; Cell = table cell;} [cell set deliget: self]; // ...}
This is the first time that I made myself a representative - protocol, so maybe it is stupid mistakes. Besides, I only learn objective-programming and programming for 4 weeks. I am
Thank you for your help!
EDIT: I think I get a problem, but I do not know how to solve it. I try to use the [_ delegload loadWeb]
; In the sub-orbit of UITextView (because this is the only way I can respond to weblink) and sub-class [_load loadWeb]; I can not use
I saw it in another method and it worked.
Your first problem is that:
id & lt; WebViewTableCellDelegate & gt; *_Representative;
should be:
id < WebViewTableCellDelegate & gt; _Representative;
id
type is already an indicator reference for an example.
Comments
Post a Comment