我無法設置大小爲(650,400)的內容。但是,即使我創建了popoverController,其寬度與創建的寬度相同&。設置PopoverContentSize時出現問題
不知道什麼是擔心? 在點擊輸入它會顯示如下
- (IBAction)setButtonTapped:(id)sender
{
popover *mpopover = [[popover alloc] init];
UINavigationController *NavController = [[UINavigationController alloc] initWithRootViewController:mpopover];
//NavController.navigationBar.backgroundColor = [UIColor darkGrayColor];
mPickerPopover = [[[UIPopoverController alloc] initWithContentViewController:NavController] retain];
CGSize popoversize = CGSizeMake(400, 90);
[mpopover setparent:mPickerPopover];
[mpopover setToolBarFrame:popoversize];
mPickerPopover.popoverContentSize = popoversize;
[mPickerPopover presentPopoverFromRect:CGRectMake([sender frame].origin.x, [sender frame].origin.y, 20, 20) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[mpopover release];
}
輕敲顯示按鈕看起來像這樣
-(void)buttonView:(id)sender
{
CGSize popoversize = CGSizeMake(650, 320);
[parent setPopoverContentSize:popoversize animated:YES];
[toolbar setFrame:CGRectMake(0, popoversize.height- 90, popoversize.width, 60)];
CATransition *transition = [CATransition animation];
transition.type = kCATransitionPush;
transition.duration = 1.0f;
transition.timingFunction = UIViewAnimationCurveEaseInOut;
[self.view.layer addAnimation:transition forKey:@"transitionViewAnimation"];
}
我想發佈您的代碼,它可能會幫助你得到答案 – lxt 2011-04-03 16:44:46