luk*_*e88 3 objective-c uiviewcontroller ios cgrectmake
我是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
Run Code Online (Sandbox Code Playgroud)
问题出在这里:
UILabel *testLabel = [[UILabel alloc] initWithFrame: GCRectMake(30,100,250,40)];
Run Code Online (Sandbox Code Playgroud)
关于GCRectMake:我有一个警告和一个错误:
WARNING Implicit declaration of function 'GCRectMake' is invalid in C99
ERROR Sending 'int' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')
Run Code Online (Sandbox Code Playgroud)
我真的无法理解有什么不对.
| 归档时间: |
|
| 查看次数: |
5967 次 |
| 最近记录: |