uiimagepickercontroller - Custom shape for camera controller IOS -


i trying give round shape camera view take image. circle should of 200 width , 200 height, , when open, user has able still interact background view. have managed until is:

- (ibaction)usecameraphoto:(id)sender {  if ([uiimagepickercontroller issourcetypeavailable:      uiimagepickercontrollersourcetypecamera]) {     uiimagepickercontroller *imagepicker =     [[uiimagepickercontroller alloc] init];     imagepicker.delegate = self;     imagepicker.sourcetype =     uiimagepickercontrollersourcetypecamera;     imagepicker.mediatypes = [nsarray arraywithobjects:                               (nsstring *) kuttypeimage,                               nil];     imagepicker.allowsediting = yes;     [self presentviewcontroller:imagepicker                             animated:yes completion:nil];      newmedia = yes;  }else{     nslog(@"camera not available");     uialertview *alert1 = [[uialertview alloc] initwithtitle:@"important message" message:@"unfortunately camera not available on device." delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil];     [alert1 show]; }  }  

this code presenting viewcontrller users can take shot, not have round shape.

i thought of doing imagepicker.allowsediting.frame = cgrectmake (30, 100, 200, 200); still not give round corners. furthermore view beneath it, if visible, not respond touch. ideas?

edit:

i have tried this. gives round corners background still black

imagepicker.modaltransitionstyle = uimodaltransitionstylecrossdissolve;     imagepicker.modalpresentationstyle = uimodalpresentationformsheet;     [self presentviewcontroller:imagepicker animated:yes completion:nil];      imagepicker.view.layer.cornerradius = 100; // value vary per desire     imagepicker.view.clipstobounds = yes;     imagepicker.view.frame = cgrectmake(40,40, 200, 200); 

instead of doing modal pop-up, can directly add camera support using avfoundation. there nice ios camera demo available free on apple developer site.

then can attach preview image uiimageview on uiviewcontroller , same thing layer desired effect:

imageview.view.layer.cornerradius = 100; // value vary per desire imageview.view.clipstobounds = yes; imageview.view.frame = cgrectmake(40,40, 200, 200); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -