Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在上下文中绘制视图,它意味着什么?_Ios_Objective C_Uiview_Draw_Cgcontext - Fatal编程技术网

Ios 在上下文中绘制视图,它意味着什么?

Ios 在上下文中绘制视图,它意味着什么?,ios,objective-c,uiview,draw,cgcontext,Ios,Objective C,Uiview,Draw,Cgcontext,我的观点是这样的: _myController = [[MSCustomViewController alloc] init]; _myController.doc = (AWDOC *)_currentDocumentViewController.activeFile.document; _myController.view.backgroundColor = [UIColor colorWithHue:0.7/3.3 saturation:0.2 brightness:1.0

我的观点是这样的:

_myController = [[MSCustomViewController alloc] init];
    _myController.doc = (AWDOC *)_currentDocumentViewController.activeFile.document;
    _myController.view.backgroundColor = [UIColor colorWithHue:0.7/3.3 saturation:0.2 brightness:1.0 alpha:1.0];
    [self.view insertSubview:_myController.view aboveSubview:_myController];
    CGSize size = [_myController.view sizeThatFits:CGSizeZero];
    if(size.height < _myController.frame.size.height)
        size.height = _myController.frame.size.height;
    CGRect myFrame = CGRectMake(0., CGRectGetMinY(_currentDocumentViewController.view.bounds) + (CGRectGetHeight(_currentDocumentViewController.view.bounds) - size.height) / 2., size.width, size.height);
    _myController.view.frame = myFrame;
    CGRect buttonFrame = CGRectMake(CGRectGetMaxX(myFrame), CGRectGetMinY(myFrame), myButton.frame.size.width, CGRectGetHeight(myFrame));
    _myButton.frame = buttonFrame;
    [_myButton setTitle:@"<" forState:UIControlStateNormal];
\u myController=[[MSCustomViewController alloc]init];
_myController.doc=(AWDOC*)\u currentDocumentViewController.activeFile.document;
_myController.view.backgroundColor=[uicolorWithHue:0.7/3.3饱和度:0.2亮度:1.0 alpha:1.0];
[self.view insertSubview:_myController.view over子视图:_myController];
CGSize size=[\u myController.view sizehattfits:CGSizeZero];
if(size.height<\u myController.frame.size.height)
size.height=\u myController.frame.size.height;
CGRect myFrame=CGRectMake(0,CGRectGetMinY(_currentDocumentViewController.view.bounds)+(CGRectGetHeight(_currentDocumentViewController.view.bounds)-size.height)/2,size.width,size.height);
_myController.view.frame=myFrame;
CGRect buttonFrame=CGRectMake(CGRectGetMaxX(myFrame)、CGRectGetMinY(myFrame)、myButton.frame.size.width、CGRectGetHeight(myFrame));
_myButton.frame=按钮框架;

[\u myButton setTitle:@“将默认UIView添加到viewcontroller,以保存内置视图,如UIButton、UIImageView、UILabel。您添加为:

UIView *view = [[[UIView alloc] initwithFrame:CGRectMake(..)];
现在,要在UIView中创建自定义图形,您必须定义自己的视图(通过创建继承UIView的新类来实现)。假设您创建的类是StandardView类。 继承UIView时,drawRect:是在视图控制器中初始化此UIView时调用的默认方法:

Standardview * stndView = [[Standardview alloc]initWithFrame:CGRectMake(0, 0, 320, 300];

因此,您可以将所有绘图内容放在drawRect:方法中。通常,您可以使用OpenGL/ES或CoreGraphics进行绘图。当使用CoreGraphics函数时,您可以为CoreGraphics的每个函数指定上下文。该上下文表示您的图形目的地。

请您进一步解释一下,您从何处获得t他的信息?这只是一个任务还不清楚,这是错误信息吗?不,这不是错误。我只是想知道我是否可以使用一些draw(cgrect等)或CGContext方法绘制视图您可以使用CGContext方法绘制视图,以清楚“在上下文中绘制视图”请参见