iPad 앱 (XCode 4.6, ios 6.2, ARC 및 스토리 보드)이 있습니다. UIView의 위치에 GCRect를 그렸습니다.그려진 사각형에 UIPopover를 연결하는 방법
CGRect rectangle = CGRectMake([appSelected.aPosX floatValue], [appSelected.aPosY floatValue],[appSelected.aPosW floatValue], [appSelected.aPosH floatValue]);
나는 그림을 그리는 방법이있다.
-(void)showHTMLHelp:(NSString *)htmlString pointTo:(id)target background:(UIColor *)bgColor {
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 300)];
popoverView.backgroundColor = [UIColor colorWithWhite:(CGFloat)1.0 alpha:(CGFloat)1.0]; // frame color?
popoverContent.view = popoverView;
//resize the popover view shown in the current view to the view's size
popoverContent.contentSizeForViewInPopover = CGSizeMake(200, 300);
// add the UIWebView for RichText
UIWebView *webView = [[UIWebView alloc] initWithFrame:popoverView.frame];
webView.backgroundColor = [UIColor whiteColor]; // change background color here
// add the webView to the popover
[webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:nil]];
[popoverView addSubview:webView];
//create a popover controller
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
//present the popover view non-modal with a refrence to the button pressed within the current view
if([target isKindOfClass: [UITextField class]])
[popoverController presentPopoverFromRect:((UITextField *)target).frame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
else if([target isKindOfClass: [UISegmentedControl class]])
[popoverController presentPopoverFromRect:((UISegmentedControl *)target).frame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
else if([target isKindOfClass: [UIButton class]])
[popoverController presentPopoverFromRect:((UIButton *)target).frame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
else
[popoverController presentPopoverFromRect:*(CGRect *)CFBridgingRetain(target)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
지금 내가 그 사각형에 UIPopover 포인트를 갖고 싶어이는 방법에 대한 코드입니다. GCRect는 C 구조체이기 때문에 어떻게해야 할지를 알 수 없습니다. 이것은 내가 시도한 것이지만, 분명히 잘못된 것입니다. 어떻게해야합니까?
PreferencesViewController *pvc = [[PreferencesViewController alloc] init];
[pvc showHTMLHelp:html pointTo: rectangle background:[UIColor whiteColor]];
'target '의 유형은 무엇입니까? GCRect가 아니라'CGRect'라고 가정합니다. – Mar0ux
** CGRectMake 생성에 대한 질문 ** – SpokaneDude