forked from n-b/UIView-NibLoading
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIView+NibLoading.h
37 lines (30 loc) · 1.2 KB
/
UIView+NibLoading.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// UIView+NibLoading.h
//
// Created by Nicolas Bouilleaud.
//
// https://github.com/n-b/UIView-NibLoading
#import <UIKit/UIKit.h>
@interface UIView (NibLoading)
// Loads the views inside a nib and adds it as subviews of the receiver.
// There must be exactly one root UIView in the nib, acting as a container for the subviews of the receiver.
// The subviews are reparented to the receiver, the container view is discarded.
//
// Additionally, the container view's size is used as the default size for the receiver :
// If the receiver's bounds is not CGRectZero, the container view is resized prior reparenting the subviews, so that the subviews are resized.
// If the receiver's bounds is CGRectZero, it's set to the container view's bounds.
//
- (void) loadContentsFromNibNamed:(NSString*)nibName;
// Convenience method, loads a nib named after the class name.
- (void) loadContentsFromNib;
@end
// Convenience UIView subclass.
//
// Custom UIViews can simply subclass NibLoadedView.
// It calls loadContentsFromNib in its initializer.
//
// If you need to subclass another UIView subclass (e.g. a custom UIControl),
// you'll need to call loadContentsFromNib yourself.
//
@interface NibLoadedView : UIView
@end