| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- //
- // LoadMoreView.m
- // Manzi
- //
- // Created by wei on 12-9-22.
- // Copyright (c) 2012年 wei. All rights reserved.
- //
- #import "LoadMoreView.h"
- @implementation LoadMoreView
- @synthesize delegate, OnLoadMore;
- - (void)OnLoadMoreClick {
- if (delegate && OnLoadMore) {
- [delegate performSelector:OnLoadMore withObject:self];
- }
- }
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor clearColor];
- mLoadMore = [UIButton buttonWithType:UIButtonTypeCustom];
- mLoadMore.frame = self.bounds;
- mLoadMore.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
- [mLoadMore addTarget:self action:@selector(OnLoadMoreClick) forControlEvents:UIControlEventTouchUpInside];
- [mLoadMore setBackgroundImage:[UIImage imageNamed:@"btnmore.png"] forState:UIControlStateNormal];
- mLoadMore.adjustsImageWhenHighlighted = YES;
- mLoadMore.adjustsImageWhenDisabled = YES;
- [self addSubview:mLoadMore];
-
- _mlbText = [[UILabel alloc] initWithFrame:mLoadMore.bounds];
- _mlbText.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
- _mlbText.backgroundColor = [UIColor clearColor];
- _mlbText.textAlignment = NSTextAlignmentCenter;
- _mlbText.font = [UIFont systemFontOfSize:14];
- _mlbText.textColor = [UIColor darkGrayColor];
- _mlbText.shadowOffset = CGSizeMake(1, 1);
- _mlbText.shadowColor = [UIColor whiteColor];
- _mlbText.text = @"显示下一页";
- [mLoadMore addSubview:_mlbText];
- // [mlbText release];
-
- }
- return self;
- }
- - (void)StartLoading {
- mLoadMore.enabled = NO;
- _mlbText.text = @"加载数据中⋯";
- }
- - (void)StopLoading {
- mLoadMore.enabled = YES;
- _mlbText.text = @"显示下一页";
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect
- {
- // Drawing code
- }
- */
- @end
|