Skip to content

Commit

Permalink
publsh custom ui api
Browse files Browse the repository at this point in the history
  • Loading branch information
xhzengAIB committed Mar 21, 2014
1 parent c578793 commit d30215f
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 89 deletions.
20 changes: 0 additions & 20 deletions Project/XHNewsFrameworkExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
AB378A4A18D8F9AF00303DB0 /* refresh.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3818D8F9AF00303DB0 /* refresh.png */; };
AB378A4B18D8F9AF00303DB0 /* refresh@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3918D8F9AF00303DB0 /* refresh@2x.png */; };
AB378A4C18D8F9AF00303DB0 /* order_back.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3A18D8F9AF00303DB0 /* order_back.png */; };
AB378A4D18D8F9AF00303DB0 /* order_back_select.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3B18D8F9AF00303DB0 /* order_back_select.png */; };
AB378A4E18D8F9AF00303DB0 /* order_background.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3C18D8F9AF00303DB0 /* order_background.png */; };
AB378A4F18D8F9AF00303DB0 /* order_drag_move_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3D18D8F9AF00303DB0 /* order_drag_move_bg.png */; };
AB378A5018D8F9AF00303DB0 /* topnav_orderbutton.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3E18D8F9AF00303DB0 /* topnav_orderbutton.png */; };
AB378A5118D8F9AF00303DB0 /* topnav_orderbutton_selected_unselected.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A3F18D8F9AF00303DB0 /* topnav_orderbutton_selected_unselected.png */; };
AB378A5218D8F9AF00303DB0 /* 列表图片@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = AB378A4018D8F9AF00303DB0 /* 列表图片@2x.jpg */; };
AB378A5318D8F9AF00303DB0 /* 图片@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = AB378A4118D8F9AF00303DB0 /* 图片@2x.jpg */; };
AB378A5418D8F9AF00303DB0 /* logo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB378A4218D8F9AF00303DB0 /* logo@2x.png */; };
Expand Down Expand Up @@ -59,11 +54,6 @@
AB378A3818D8F9AF00303DB0 /* refresh.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = refresh.png; sourceTree = "<group>"; };
AB378A3918D8F9AF00303DB0 /* refresh@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "refresh@2x.png"; sourceTree = "<group>"; };
AB378A3A18D8F9AF00303DB0 /* order_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = order_back.png; sourceTree = "<group>"; };
AB378A3B18D8F9AF00303DB0 /* order_back_select.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = order_back_select.png; sourceTree = "<group>"; };
AB378A3C18D8F9AF00303DB0 /* order_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = order_background.png; sourceTree = "<group>"; };
AB378A3D18D8F9AF00303DB0 /* order_drag_move_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = order_drag_move_bg.png; sourceTree = "<group>"; };
AB378A3E18D8F9AF00303DB0 /* topnav_orderbutton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = topnav_orderbutton.png; sourceTree = "<group>"; };
AB378A3F18D8F9AF00303DB0 /* topnav_orderbutton_selected_unselected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = topnav_orderbutton_selected_unselected.png; sourceTree = "<group>"; };
AB378A4018D8F9AF00303DB0 /* 列表图片@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "列表图片@2x.jpg"; sourceTree = "<group>"; };
AB378A4118D8F9AF00303DB0 /* 图片@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "图片@2x.jpg"; sourceTree = "<group>"; };
AB378A4218D8F9AF00303DB0 /* logo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "logo@2x.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -180,11 +170,6 @@
AB378A3818D8F9AF00303DB0 /* refresh.png */,
AB378A3918D8F9AF00303DB0 /* refresh@2x.png */,
AB378A3A18D8F9AF00303DB0 /* order_back.png */,
AB378A3B18D8F9AF00303DB0 /* order_back_select.png */,
AB378A3C18D8F9AF00303DB0 /* order_background.png */,
AB378A3D18D8F9AF00303DB0 /* order_drag_move_bg.png */,
AB378A3E18D8F9AF00303DB0 /* topnav_orderbutton.png */,
AB378A3F18D8F9AF00303DB0 /* topnav_orderbutton_selected_unselected.png */,
AB378A4018D8F9AF00303DB0 /* 列表图片@2x.jpg */,
AB378A4118D8F9AF00303DB0 /* 图片@2x.jpg */,
AB378A4218D8F9AF00303DB0 /* logo@2x.png */,
Expand Down Expand Up @@ -297,25 +282,20 @@
buildActionMask = 2147483647;
files = (
AB378A5618D8F9AF00303DB0 /* managerMenuButton@2x.png in Resources */,
AB378A4F18D8F9AF00303DB0 /* order_drag_move_bg.png in Resources */,
AB378A4A18D8F9AF00303DB0 /* refresh.png in Resources */,
AB378A5718D8F9AF00303DB0 /* rightShadow@2x.png in Resources */,
AB378A5418D8F9AF00303DB0 /* logo@2x.png in Resources */,
AB378A4D18D8F9AF00303DB0 /* order_back_select.png in Resources */,
AB86830818942CFE00765392 /* InfoPlist.strings in Resources */,
AB378A5118D8F9AF00303DB0 /* topnav_orderbutton_selected_unselected.png in Resources */,
AB378A5818D8F9AF00303DB0 /* statusbar_close.png in Resources */,
AB378A5518D8F9AF00303DB0 /* leftShadow@2x.png in Resources */,
AB378A5218D8F9AF00303DB0 /* 列表图片@2x.jpg in Resources */,
AB378A4E18D8F9AF00303DB0 /* order_background.png in Resources */,
AB378A5918D8F9AF00303DB0 /* statusbar_close@2x.png in Resources */,
AB378A4C18D8F9AF00303DB0 /* order_back.png in Resources */,
AB378A5B18D8F9AF00303DB0 /* info_offline_flash@2x.png in Resources */,
AB378A5318D8F9AF00303DB0 /* 图片@2x.jpg in Resources */,
AB86831018942CFE00765392 /* Images.xcassets in Resources */,
AB378A5A18D8F9AF00303DB0 /* info_offline_flash.png in Resources */,
AB378A4B18D8F9AF00303DB0 /* refresh@2x.png in Resources */,
AB378A5018D8F9AF00303DB0 /* topnav_orderbutton.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
143 changes: 78 additions & 65 deletions Project/XHNewsFrameworkExample/XHNeteaseNewsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,72 +65,85 @@ - (XHScrollBannerView *)scrollBannerView {
}
#pragma mark - Life cycle

- (id)init {
if (self = [super init]) {
NSMutableArray *items = [NSMutableArray new];
NSMutableArray *unItems = [NSMutableArray new];
int numberOfPanels = 15;
for (int i = 0; i < numberOfPanels; i++) {
XHMenu *item = [[XHMenu alloc] init];
NSString *title;
switch (i) {
case 0:
title = @"头条";
break;
case 1:
title = @"热点新闻";
break;
case 2:
title = @"原创";
break;
case 3:
title = @"汽车";
break;
case 4:
title = @"CBA";
break;
case 5:
title = @"NBA";
break;
case 6:
title = @"热点新闻";
break;
case 8:
title = @"房产";
break;
case 9:
title = @"新闻热点";
break;
default:
title = @"热点";
break;
}
item.title = title;
item.titleNormalColor = [UIColor colorWithWhite:0.141 alpha:1.000];
item.titleFont = [UIFont boldSystemFontOfSize:16];

XHMenu *unItem = [[XHMenu alloc] init];
unItem.title = [NSString stringWithFormat:@"Title%d", i + numberOfPanels];
unItem.titleNormalColor = [UIColor colorWithWhite:0.141 alpha:1.000];
unItem.titleFont = [UIFont boldSystemFontOfSize:16];

NSMutableArray *rows = [NSMutableArray array];
int numberOfRows = 10;
for (int j = 0; j < numberOfRows; j++) {
XHNewsDetail *newsDetail = [[XHNewsDetail alloc] init];
newsDetail.newsTitle = @"新浪微博被收购";
newsDetail.newsContent = @"不知道为什么,就这样被收购了,可能是还没有发挥创新吧!";
[rows addObject:newsDetail];
}
item.dataSources = rows;
unItem.dataSources = rows;

[items addObject:item];

[unItems addObject:unItem];
- (void)loadDataSource {
NSMutableArray *items = [NSMutableArray new];
NSMutableArray *unItems = [NSMutableArray new];
int numberOfPanels = 15;
for (int i = 0; i < numberOfPanels; i++) {
XHMenu *item = [[XHMenu alloc] init];
NSString *title;
switch (i) {
case 0:
title = @"头条";
break;
case 1:
title = @"热点新闻";
break;
case 2:
title = @"原创";
break;
case 3:
title = @"汽车";
break;
case 4:
title = @"CBA";
break;
case 5:
title = @"NBA";
break;
case 6:
title = @"热点新闻";
break;
case 8:
title = @"房产";
break;
case 9:
title = @"新闻热点";
break;
default:
title = @"热点";
break;
}
item.title = title;
item.titleNormalColor = [UIColor colorWithWhite:0.141 alpha:1.000];
item.titleFont = [UIFont boldSystemFontOfSize:16];

XHMenu *unItem = [[XHMenu alloc] init];
unItem.title = [NSString stringWithFormat:@"Title%d", i + numberOfPanels];
unItem.titleNormalColor = [UIColor colorWithWhite:0.141 alpha:1.000];
unItem.titleFont = [UIFont boldSystemFontOfSize:16];

NSMutableArray *rows = [NSMutableArray array];
int numberOfRows = 10;
for (int j = 0; j < numberOfRows; j++) {
XHNewsDetail *newsDetail = [[XHNewsDetail alloc] init];
newsDetail.newsTitle = @"新浪微博被收购";
newsDetail.newsContent = @"不知道为什么,就这样被收购了,可能是还没有发挥创新吧!";
[rows addObject:newsDetail];
}
self.items = items;
self.unItems = unItems;
item.dataSources = rows;
unItem.dataSources = rows;

[items addObject:item];

[unItems addObject:unItem];
}
self.items = items;
self.unItems = unItems;
}

- (id)init {
self = [super init];
if (self) {
// custom UI
self.topScrollViewToolBarBackgroundColor = [UIColor colorWithRed:0.362 green:0.555 blue:0.902 alpha:1.000];
self.indicatorColor = [UIColor colorWithRed:0.219 green:0.752 blue:0.002 alpha:1.000];
self.managerButtonBackgroundImage = [UIImage imageNamed:@"managerMenuButton"];

self.midContentLogoImage = [UIImage imageNamed:@"logo"];
self.contentScrollViewBackgroundColor = [UIColor colorWithRed:1.000 green:0.724 blue:0.640 alpha:1.000];

[self loadDataSource];
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
@property (nonatomic, strong) UIColor *titleSelectedColor;
@property (nonatomic, strong) UIColor *titleHighlightedColor;

@property (nonatomic, strong) UIImage *normalImage;
@property (nonatomic, strong) UIImage *hightlightedImage;
@property (nonatomic, strong) UIImage *selectedImage;

@property (nonatomic, copy) NSString *dataSourcesStringUrl;
@property (nonatomic, strong) NSArray *dataSources;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
- (XHContentView *)dequeueReusablePageWithIdentifier:(NSString*)identifier;
- (XHContentView *)contentViewAtPage:(NSInteger)page;

#pragma mark editing
- (void)setEditing:(BOOL)isEditing;
- (void)shouldWiggle:(BOOL)wiggle;

#pragma mark frame and sizes
- (CGRect)scrollViewFrame;
- (CGSize)contentViewSize;
Expand All @@ -37,6 +33,20 @@
#pragma mark - DataSource
- (NSInteger)numberOfContentViews;

#pragma mark - scroll the contentView
- (void)goToContentView:(NSInteger)index;

#pragma mark - Custom UI
// top
@property (nonatomic, strong) UIImage *topScrollViewToolBarBackgroundImage; // default is nil
@property (nonatomic, strong) UIColor *topScrollViewToolBarBackgroundColor; // default is [UIColor colorWithWhite:0.902 alpha:1.000]
@property (nonatomic, strong) UIImage *managerButtonBackgroundImage; // default is arrow image
@property (nonatomic, strong) UIColor *indicatorColor; // default is redColor

// mid
@property (nonatomic, strong) UIImage *midContentLogoImage; // default is netEase logo

// contentScrollView
@property (nonatomic, strong) UIColor *contentScrollViewBackgroundColor; // default is [UIColor whiteColor]

@end
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) XHIndicatorView *indicatorView;

- (void)setBackgroundImage:(UIImage *)backgroundImage;
- (void)setContainerBackgroundColor:(UIColor *)backgroundColor;
- (void)setManagerButtonImage:(UIImage *)managerButtonImage;
- (void)setIndicatorColor:(UIColor *)indicatorColor;

// DataSource
@property (nonatomic, strong) NSArray *menus;

Expand Down
Binary file not shown.
Binary file removed Project/XHNewsFrameworkExample/order_back_select.png
Binary file not shown.
Binary file removed Project/XHNewsFrameworkExample/order_background.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit d30215f

Please sign in to comment.