ビューコントローラーから生成されるコンテンツを含む UIPopovercontroller があります。
popOverController = [[UIPopoverController alloc]initWithPopUp:emLightPopUp];
popOverController.delegate = self;
// Get device position.
CGRect position = {parentButton.frame.origin,emLightPopUp.popUpView.frame.size};
CGSize popUpViewFrameSize = emLightPopUp.popUpView.frame.size;
リンクのスクリーンショット: http://i.stack.imgur.com/AxqoG.png
問題は、選択したデバイス (タッチされたボタン) の位置を上に変更すると、表示されるポップアップがスクリーンショットのようにサイズ変更されることです。
既に uipopover のサブクラス内でコンテンツ サイズを設定しようとしていますが、まだ機能しません。
self.popoverContentSize = emLightPopUp.popUpView.frame.size;
編集: ポップアップを表示し、スクロールビューを内側にスクロールして上の位置にスクロールする位置を計算することで、この問題を解決しました。このコードをチェックしてください:
-(void)moveDeviceOutMiddleScreen:(id)deviceButton
{
UIButton* button = (UIButton*)deviceButton;
CGFloat yPositionRange = button.frame.origin.y - self.floorZoomScrollView.contentOffset.y;
int middle_top_y = 70;
int middle_bottom_y = 166;
if (yPositionRange > middle_top_y && yPositionRange < middle_bottom_y) {
CGRect newRect = CGRectMake(self.floorZoomScrollView.contentOffset.x,
self.floorZoomScrollView.contentOffset.y +yPositionRange*0.6,
self.floorZoomScrollView.frame.size.width, self.floorZoomScrollView.frame.size.height);
[self.floorZoomScrollView scrollRectToVisible:newRect animated:NO];
}
}
ご回答ありがとうございます。