Add support for custom frame #37

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+13 −1
Split
@@ -30,6 +30,9 @@
- (id)initInScrollView:(UIScrollView *)scrollView;
+// use custom frame
+- (id)initWithFrame:(CGRect)frame InScrollView:(UIScrollView *)scrollView;
+
// use custom activity indicator
- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity;
@@ -51,9 +51,18 @@ - (id)initInScrollView:(UIScrollView *)scrollView {
return [self initInScrollView:scrollView activityIndicatorView:nil];
}
+- (id)initWithFrame:(CGRect)frame InScrollView:(UIScrollView *)scrollView {
+ self = [super initWithFrame:frame];
+ return [self initInScrollView:scrollView activityIndicatorView:nil];
+}
+
- (id)initInScrollView:(UIScrollView *)scrollView activityIndicatorView:(UIView *)activity
{
- self = [super initWithFrame:CGRectMake(0, -(kTotalViewHeight + scrollView.contentInset.top), scrollView.frame.size.width, kTotalViewHeight)];
+ if (CGRectEqualToRect(self.frame, CGRectZero)) {
+ CGRect sRect = CGRectMake(0, -(kTotalViewHeight + scrollView.contentInset.top),
+ scrollView.frame.size.width, kTotalViewHeight);
+ self = [super initWithFrame:sRect];
+ }
if (self) {
self.scrollView = scrollView;