自定義美團的導航欄

自定義美團的導航欄
1.在xib中自定義navigationItem的樣式,使用autolayout適配不同的屏幕,自定義下拉二級菜單。
2.項目使用MVC編程模式 創建兩個模型:
商品分類模型 CategoryModel

@interface CategoryModel : NSObject

#pragma mark - 聲明屬性
//圖標
@property (copy,nonatomic)NSString * highlighted_icon;
@property (copy,nonatomic)NSString * small_highlighted_icon;
@property (copy,nonatomic)NSString * icon;
@property (copy,nonatomic)NSString * small_icon;
//名稱
@property (copy,nonatomic)NSString * name;
//子數據數組
@property (strong,nonatomic)NSArray * subcategories;

城市選擇模型 CityGroupModel

#import <Foundation/Foundation.h>

@interface CityGroupModel : NSObject

@property(nonatomic,strong) NSArray *cities;
@property(nonatomic,copy) NSString *title;

3.點擊導航欄彈出PopViewController,顯示商品分類或選擇城市

- (void)createCategoryPopver{
    PopViewController *pvc = [[PopViewController alloc]init];
    UIPopoverController *pop = [[UIPopoverController alloc]initWithContentViewController:pvc];
    [pop presentPopoverFromBarButtonItem:firstItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

4.顯示商品分類的PopViewController中包含兩個並列的tableview,城市選擇能使用搜功能,排列是以字母順序表,點擊搜索出現一個透明的蒙板
這裏寫圖片描述
這裏寫圖片描述
這裏寫圖片描述
5.功能還待繼續完善
github地址::https://github.com/ywwill/MeiTuan

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章