Skip to content

qingyunhe/HQYModules

Repository files navigation

HQYModules

集成iOS开发中常用功能模块.

GitHub:何青云 | Blog:江城程序猿 | Contact me:developerqingyun@gmail.com


##目录


###UICollectionView重排

Mou icon


###级联菜单 Mou icon

####实现思路:

1 分别使用两个继承于UITableViewController的控制器管理左右两侧菜单,分别命名为HQYMainCategoryController(左菜单控制器)和HQYSubCategoryController(右菜单控制器).

2 使用导航控制器push出来的控制器(命名为HQYCascadingMenuController)来管理HQYMainCategoryControllerHQYSubCategoryController,将HQYMainCategoryControllerHQYSubCategoryController添加为HQYCascadingMenuController的子控制器,并将子控制器的view作为子控件添加到HQYCascadingMenuControllerview中.

3 使用代理传值,将HQYMainCategoryController中的数据传递给HQYSubCategoryController.

####注意事项: 1 默认HQYMainCategoryControllerview第0行cell应该处于选中状态,该业务逻辑应该在viewWillAppear方法中实现,而非在viewDidLoad方法中实现.

- (void)viewWillAppear:(BOOL)animated{
    
    [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:(UITableViewScrollPositionTop)];
    // 显示第0行数据
    [self showSubCategoriesDataOfArrowZero];
}

2 默认HQYSubCategoryControllerview展示HQYMainCategoryControllerview第0行cell对应的数据.

- (void)showSubCategoriesDataOfArrowZero{

    if ([self.delegate respondsToSelector:@selector(categoryViewController:didSelectSubCategories:)]) {
        NSDictionary *dict = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"health.plist" ofType:nil]][0];
        HYQHealthItem *item = [HYQHealthItem categoryWithDict:dict];
        [self.delegate categoryViewController:self didSelectSubCategories:item.subcategories];
    }
}

HQYStatusBar自定义状态栏

Mou icon

####实现过程: 1 拿到UIStatusBarForegroundView对象

   UIApplication *app = [UIApplication sharedApplication];
   UIView *statusBar = [app valueForKeyPath:@"statusBar"];
   statusBar.frame = (CGRect){0, 100, 350, 50};
   statusBar.center = self.view.center;
   statusBar.backgroundColor = [UIColor orangeColor];
   UIView *barForegroundView =  statusBar.subviews[1];

2 对系统状态栏的私有属性进行个性化设置(以网络服务商为例)

   UIView *seviceView =  barForegroundView.subviews[0];
   CGRect seviceFrame = seviceView.frame;
   seviceFrame.size.width = 2 *  seviceFrame.size.width;
   seviceView.frame = seviceFrame;
   seviceView.hidden = YES;
   UILabel *seviceLabel = [[UILabel alloc] init];
   seviceLabel.frame = seviceFrame;
   seviceLabel.text = @"66666";
   seviceLabel.font = [UIFont systemFontOfSize:10];
   [barForegroundView addSubview:seviceLabel];
   

HQYDownMenu自定义下拉菜单

####注意事项: 1 不能将downMenuView添加到主窗口中

[[UIApplication sharedApplication].keyWindow addSubview:downMenuView];

而应该添加到HQYDownMenu中


动画组

####实现过程:

照片选择器


待续 😄

About

集成iOS开发中常用功能模块

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published