I'm new in the iOS programming.
I am following a guide, a book precisely on iOS in Italian.
For the first application, I have to modify ViewController.m
like this:
#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
The problem is here:
UILabel *testLabel = [[UILabel alloc] initWithFrame: GCRectMake(30,100,250,40)];
On the GCRectMake
: I've one warning and one errors:
WARNING Implicit declaration of function 'GCRectMake' is invalid in C99
ERROR Sending 'int' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')
I really can not understand what is wrong.
It's CGRectMake
, not GCRectMake
. The CG stands for Core Graphics.