C&C++   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了objective-c – GCRectMake的iOS错误 – 将’int’发送到不兼容类型’CGRect'(又名’struct CGRect’)的参数大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我是iOS编程的新手.

我正在关注一本指南,这本书正是在意大利语的iOS上.
对于第一个应用程序,我必须像这样修改ViewController.m:

#import "ViewController.h"

@implementation ViewController

- (void)didReceiveMemoryWarning{
    [super didReceiveMemoryWarning];
    // Release Any chached data,images,etc that aren't in use.
}    

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view,typically from a nib.
}

- (void)datiDettaglioChiudi:(datiDettaglio *)controller{
    //altre operazioni possibii dopo la dismissModal
    NSLog(@"... di ritorno dal DismissModal...");
    [controller dismissviewControllerAnimated:YES completion:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([segue.identifier isEqualToString:@"dettaglio"]){
        datiDettaglio *mioController1 = segue.desTinationViewController;
        [mioController1 setDelegate:self];
        //aggiunta di una UILabel - qui è possibile personalizzare la propria vista     direttamente da coDice
        UILabel *testLabel = [[UILabel alloc] initWithFrame: GCRectMake(30,100,250,40)];
        [testLabel setText:@"Etichetta di test"];
        [testLabel setBACkgroundColor:[UIColor greenColor]];
        [testLabel setTextColor:[UIColor blackColor]];
        [mioController1.view addSubview:testLabel];

    }
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}


@end

问题出在这里

UILabel *testLabel = [[UILabel alloc] initWithFrame: GCRectMake(30,40)];

在GCRectMake上:我有一个警告和一个错误

WARNING Implicit declaration of function 'GCRectMake' is invalid in C99
ERROR   Sending 'int' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')

我真的无法理解有什么不对.

解决方法

它是CGRectMake,而不是GCRectMake. CG代表Core Graphics.

大佬总结

以上是大佬教程为你收集整理的objective-c – GCRectMake的iOS错误 – 将’int’发送到不兼容类型’CGRect'(又名’struct CGRect’)的参数全部内容,希望文章能够帮你解决objective-c – GCRectMake的iOS错误 – 将’int’发送到不兼容类型’CGRect'(又名’struct CGRect’)的参数所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。