2015-12-22 76 views
-2
ActionsViewController *actionsViewController = [AppLibrary createActionsViewController]; 
actionsViewController.actionDelegate = self; 
actionsViewController.supportedActionTypes = @[[[SupportedAction alloc] initWithActionType:ActionTypeEdit mediaTypes:@[kTypePNG]]]; 

[actionsViewController setWhitelistedSubTypes:@[@"adjust", @"filter", @"healing"]]; 

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 
    self.actionsNavigationController = [[UINavigationController alloc] initWithRootViewController:actionsViewController]; 
    [self presentViewController:self.actionsNavigationController animated:YES completion:nil]; 
} 
+1

- (IBAction爲)去:(ID)發送; – alideny

+1

只是如何從按鈕調用此代碼? – alideny

+0

這可能有所幫助:http://stackoverflow.com/questions/5843427/how-do-you-add-an-action-to-a-button-programmatically-in-xcode。在按鈕事件中,您可以粘貼您所需的功能代碼。 – Mrunal

回答

1

只是

-(IBAction)go:(id)sender 
{ 
ActionsViewController *actionsViewController = [AppLibrary createActionsViewController]; 
actionsViewController.actionDelegate = self; 
actionsViewController.supportedActionTypes = @[[[SupportedAction alloc] initWithActionType:ActionTypeEdit mediaTypes:@[kTypePNG]]]; 

[actionsViewController setWhitelistedSubTypes:@[@"adjust", @"filter", @"healing"]]; 

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 
    self.actionsNavigationController = [[UINavigationController alloc] initWithRootViewController:actionsViewController]; 
    [self presentViewController:self.actionsNavigationController animated:YES completion:nil]; 
} 
} 

添加此請檢查以下文件: Apple Doc

+0

謝謝。有用) – alideny