diff --git a/WZLBadgeDemo.xcodeproj/project.xcworkspace/xcuserdata/wzl.xcuserdatad/UserInterfaceState.xcuserstate b/WZLBadgeDemo.xcodeproj/project.xcworkspace/xcuserdata/wzl.xcuserdatad/UserInterfaceState.xcuserstate index 9e16cf6..2dc0dec 100644 Binary files a/WZLBadgeDemo.xcodeproj/project.xcworkspace/xcuserdata/wzl.xcuserdatad/UserInterfaceState.xcuserstate and b/WZLBadgeDemo.xcodeproj/project.xcworkspace/xcuserdata/wzl.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/WZLBadgeDemo/TableViewDataSource.m b/WZLBadgeDemo/TableViewDataSource.m index 059b799..4543df9 100644 --- a/WZLBadgeDemo/TableViewDataSource.m +++ b/WZLBadgeDemo/TableViewDataSource.m @@ -62,14 +62,6 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte return headTitles[section]; } -- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section -{ - if (section == [self.dataItems count] - 1) { - return @"Select cell to clear badge."; - } - return nil; -} - #pragma mark - delegate of UITableView //to be simple, I also add delegate into datasource. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/WZLBadgeDemo/ViewController.m b/WZLBadgeDemo/ViewController.m index b827d24..dc310fb 100644 --- a/WZLBadgeDemo/ViewController.m +++ b/WZLBadgeDemo/ViewController.m @@ -28,7 +28,6 @@ - (void)viewDidLoad { [self loadTableViewDataSource]; } - #pragma mark -- private methods - (void)setup { @@ -56,6 +55,7 @@ - (NSMutableArray *)prepareDataItems NSMutableArray *staticBadges = [NSMutableArray array]; NSMutableArray *dynamicBadges = [NSMutableArray array]; + // static badge configure WBadgeStyle styles[] = {WBadgeStyleRedDot, WBadgeStyleNew, WBadgeStyleNumber, WBadgeStyleNumber}; for (NSInteger i = 0; i < sizeof(styles) / sizeof(styles[0]); i++) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -74,9 +74,7 @@ - (NSMutableArray *)prepareDataItems [staticBadges addObject:btn]; } -// mutle tableview and collectionview to embed - - + // animating badge config WBadgeAnimType animations[] = {WBadgeAnimTypeShake, WBadgeAnimTypeBounce, WBadgeAnimTypeBreathe, WBadgeAnimTypeScale}; for (NSInteger i = 0; i < sizeof(animations) / sizeof(animations[0]); i++) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -108,7 +106,7 @@ - (NSMutableArray *)prepareDataItems #pragma mark - tableView delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if ([indexPath isEqual:[NSIndexPath indexPathForRow:0 inSection:2]]) { - [self presentViewController:[TableViewCollectionViewController new] animated:NO completion:nil]; + [self.navigationController pushViewController:[TableViewCollectionViewController new] animated:YES]; } diff --git a/WZLBadgeDemo/examples/TableViewCollectionViewController.m b/WZLBadgeDemo/examples/TableViewCollectionViewController.m index 4cdb09d..9f634d3 100644 --- a/WZLBadgeDemo/examples/TableViewCollectionViewController.m +++ b/WZLBadgeDemo/examples/TableViewCollectionViewController.m @@ -9,7 +9,6 @@ #import "TableViewCollectionViewController.h" #import "WZLBadgeImport.h" -//tableview 中有collectionView @interface TableViewCollectionViewController () @property (nonatomic, strong) UITableView *tableView; @@ -24,6 +23,7 @@ @implementation TableViewCollectionViewController - (void)viewDidLoad { [super viewDidLoad]; + self.title = @"test cell reuse"; self.view.backgroundColor = [UIColor whiteColor]; self.tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain]; @@ -50,7 +50,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class]) forIndexPath:indexPath]; cell.textLabel.text = @"hello words"; - cell.textLabel.backgroundColor = [UIColor blueColor]; + cell.textLabel.backgroundColor = [UIColor whiteColor]; cell.detailTextLabel.text = @"description text"; cell.detailTextLabel.backgroundColor = [UIColor greenColor]; @@ -81,7 +81,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 80.f; + return 60.f; } @end