objective-c – GCRectMake的iOS错误 – 将’int’发送到不兼容
发布时间:2020-12-16 10:23:35 所属栏目:百科 来源:网络整理
导读:我是iOS编程的新手. 我正在关注一本指南,这本书正是在意大利语的iOS上. 对于第一个应用程序,我必须像这样修改ViewController.m: #import "ViewController.h"@implementation ViewController- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarnin
我是iOS编程的新手.
我正在关注一本指南,这本书正是在意大利语的iOS上. #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.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |