Created
February 3, 2012 10:18
-
-
Save ananfang/1729514 to your computer and use it in GitHub Desktop.
Load nib file as GUI component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomView.h | |
// | |
// Created by Fang Andy on 12/2/3. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#define UPLOADING_WORDING @"Uploading %i photo(s)..." | |
@interface CustomView : UIView | |
@property (nonatomic, weak) IBOutlet UIActivityIndicatorView *activityIndicatorView; | |
@property (nonatomic, weak) IBOutlet UILabel *uploadingLabel; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomView.m | |
// | |
// Created by Fang Andy on 12/2/3. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import "CustomView.h" | |
@implementation CustomView | |
@synthesize activityIndicatorView = _activityIndicatorView; | |
@synthesize uploadingLabel = _uploadingLabel; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.h | |
// | |
// Created by Fang Andy on 12/1/18. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface ViewController : UIViewController | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// | |
// Created by Fang Andy on 12/1/18. | |
// Copyright (c) 2012年 Openmouse Studio. All rights reserved. | |
// | |
#import "ViewController.h" | |
#import "CustomView.h" | |
@implementation ViewController | |
#pragma mark - View lifecycle | |
- (void)viewDidAppear:(BOOL)animated | |
{ | |
[super viewDidAppear:animated]; | |
NSArray *xibViews = [[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil]; | |
CustomView *customView = nil; | |
for (id subXib in xibViews) { | |
if ([subXib isMemberOfClass:[CustomView class]]) { | |
customView = subXib; | |
} | |
} | |
[self.view addSubview:customView]; | |
[customView.activityIndicatorView startAnimating]; | |
customView.uploadingLabel.text = [NSString stringWithFormat:UPLOADING_WORDING, 2]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment