Tuesday 15 June 2010

ios - UIActivityViewController called from button in Custom Cell -


In my table view, I have several custom cells. One is called a button cell because it has several buttons in them One of the shared buttons is that I'm trying to call a UIActivityViewController. However, I can not get it to work. I have subclassed UITableViewCell and it is called buttonkail. In the header file I have linked IBAction to the stock. In the implementation file (button k.m), I have made the following efforts.

  - (IBAction) Share {NSString * initialText = [NSString stringWithFormat: @ "I like this Catherine Cooler blog post:"]; UIImage * image = [UIImage imageNamed: @ "iTunesArtwork.png"]; UIActivityViewController * AVC = [[UIActivityViewController alloc] initWithActivityItems: @ [image, initial lesson] Application performance: zero]; [Self-present ViewController: Animated AVC: Yes Completed: Zero]; }   

However, compliance does not like itself, it does not display the possibilities of the current ViewController: Animated: A way to show a UIActivityViewController from a custom cell with a button full of buttons Thanks for all your help.

Edit # 1 Thank you for Michael and A-Live, I know this. Thanks again for all the help.

In my cellularout mode, I used the following line of code:

  [buttonCell.shareButton addTarget: self action: @selector (share title) Control events: UICTCLeft TouchUp Inside];   

By adding the target I was able to locate the tap and call the sharing method. It then brings the UIActivityViewController and works as I had planned! Thanks for all the information and links.

UITableViewCell does not descend from UIView and is not UIViewController, which is the reason " Current ViewController: Animated: Completion: "There is not an option for you from your sub-group table view cell

If you want to present your Activity View Controller, you (somehow) Need to get references that are sitting inside your cell (which is in a table, which is in the content view etc.)

and then with the view controller reference (which I am naming " myViewController "), you can type " [myViewController presentViewController: AVC Animated: Yes Full: Zero]; "

One more thing: For Objective-C, the best practice is to start variables and method names with lower case letters.

No comments:

Post a Comment