Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rahulratthen91

macrumors newbie
Original poster
May 4, 2012
1
0
Guys,
I am new to app designing. I've been through several tutorials but most of them are for lesser versions of Xcode. I am breaking my head as what the problem would be in this code!
Code:
- (BOOL)application: (UIApplication * )application didFinishLaunchingWithOptions: (NSDictionary * )launchOptions
{
    // Override point for customization after application launch.
    UILabel *mylabel;
    mylabel=[[UILabel alloc]initWithFrame:CGRectMake(25,25,100,100)];
    mylabel.text=@"hi";
    mylabel.font=[UIFont systemFontOfSize:20];
    [_window addSubview:mylabel];
    [mylabel release];
    [_window makeKeyAndVisible];
    return YES;
}
i disabled Objective-C Automatic Reference Count feature since "release" was a problem. Now my code compiles and runs yet i dont find the "hi" on my iphone simulator.


And also i was going through the Nib files creation. I created a subclass of UIView and created an empty Nib file. Just dragged a view and a label into it and connected it with the UILabel variable declared in the .h file.Also connected the IBOutlet label with the view. Added the linking lines
Code:
NSArray *screens=[[NSBundle mainBundle] loadNibNamed:@"mynib" owner:self options:nil];          
[self addSubview:[screens objectAtIndex:0]];
in the .m file. Yet i get a plain white screen in IPhone simulator.

Glad if someone can help me with these basics,

Thanking in advance,
Rahul

Intel MBP 13' , OSx 10.7.3 , Xcode 4.3.2
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.