PopimagepickerViewController.h UIPopoverController *popoverController; UIPopoverController *popoverimagview; // imagepicker popoverview PopimagepickerViewController.m -(IBAction)popbtn_Click:(id)sender
{
UIViewController*
popoverContent = [[UIViewController
alloc]
init];
UIView*
popoverView = [[UIView
alloc]
initWithFrame:CGRectMake(0,
0,230,180)];
popoverView.backgroundColor
= [UIColor
whiteColor];
popoverContent.view=popoverView;
popoverContent.contentSizeForViewInPopover
= CGSizeMake(230,
180);
//
Set the popoverview Width and height
//create
a popover controller
popoverController
= [[UIPopoverController
alloc]
initWithContentViewController:popoverContent];
CGRect
popoverRect = [self.view
convertRect:[popbtn
frame]
fromView:[popbtn
superview]];
popoverRect.size.width
= MIN(popoverRect.size.width,
100)
;
popoverRect.origin.x
= popoverRect.origin.x;
[popoverController
presentPopoverFromRect:popoverRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp
+
UIPopoverArrowDirectionLeft
//pooverview
down direction
animated:YES];
[popoverView
release];
[popoverContent
release];
}
Note:
To create uiimagepicker for Ipad not showing normal imagepicker
control animation like ipod.but it shows like popoverview.
-(void)select_btnclick:(id)sender
{
UIImagePickerController
* picker = [[UIImagePickerController
alloc]
init];
picker.delegate
= self;
if((UIButton
*) sender == select_btn)
{
picker.sourceType
= UIImagePickerControllerSourceTypeSavedPhotosAlbum;
popoverimagview
= [[UIPopoverController
alloc]
initWithContentViewController:picker];
[picker
release];
[popoverimagview
presentPopoverFromRect:CGRectMake(0.0,
0.0,
350,
350)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
else
{
picker.sourceType
= UIImagePickerControllerSourceTypeCamera;
}
}
//dismissPopoverview
if
(popoverimagview
!= nil)
{
[popoverimagview
dismissPopoverAnimated:YES];
}
No comments:
Post a Comment