0

In one of my projects I have integrated the aviary sdk . When I use the presentmodalViewcontroller it is working . But when I use the addsubview method it is crashing when I click any button in the Editorcontroller .

enter image description here

AFPhotoEditorController *featherController = [[[AFPhotoEditorController alloc] initWithImage:image] autorelease];
[featherController setDelegate:self];
[featherController.view setBackgroundColor:[UIColor blackColor]];
featherController.view.frame = CGRectMake(0, 0, 512, 748);
[self.view addSubview:featherController.view];
//[self presentModalViewController:featherController animated:YES];

Please let me know if I am not clear . Thanks in advance .

SRI
  • 1,514
  • 21
  • 39
Tendulkar
  • 5,550
  • 2
  • 27
  • 53

1 Answers1

1
Import AFPhotoEditorController.h in AppDelegate.

Set property to object of AFPhotoEditorController in AppDelegate.h
@property (nonatomic,strong) AFPhotoEditorController *featherController;

Then Declare two methods in AppDelegate.h
-(void)fn_showAFPhotoEditorController;
-(void)fn_removeAFPhotoEditorController;

And synthesize it in AppDelegate.m

@synthesize featherController=_featherController;



-(void)fn_showAFPhotoEditorController{
    AFPhotoEditorController * obj1 =[[AFPhotoEditorController alloc]init];
    [self setfeatherController:obj1];

    [self.window addSubview:[_featherController view]];
    [self setNewViewToLandscape:[_featherController view]];

}
-(void)fn_removeAFPhotoEditorController{
  [_featherController.view removeFromSuperview];

    _featherController=nil; 
}


After that create an instance of AppDelegate wherever you want and just give a call to show view and remove it.

AppDelegate *obj=(AppDelegate *)[[UIApplication sharedApplication] delegate];
[obj fn_showAFPhotoEditorController];////To Show view

[obj fn_removeAFPhotoEditorController];////To Remove it.
Aniket Kote
  • 541
  • 3
  • 9