Prechádzať zdrojové kódy

我的(更多)VC UI完成

hxb 8 rokov pred
rodič
commit
abb467c2ca

+ 4 - 0
WSCloudStorage.xcodeproj/project.pbxproj

@@ -142,6 +142,7 @@
 		ACF539FE1F38038F00D4F08A /* BAGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = ACF539F51F38038F00D4F08A /* BAGridView.m */; };
 		ACF539FF1F38038F00D4F08A /* BAGridViewTypeTitleDescCell.m in Sources */ = {isa = PBXBuildFile; fileRef = ACF539F71F38038F00D4F08A /* BAGridViewTypeTitleDescCell.m */; };
 		ACF53A001F38038F00D4F08A /* NSString+BAGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = ACF539FB1F38038F00D4F08A /* NSString+BAGridView.m */; };
+		ACF53A021F3806A700D4F08A /* gridviewtest.png in Resources */ = {isa = PBXBuildFile; fileRef = ACF53A011F3806A700D4F08A /* gridviewtest.png */; };
 		F75984292A24757670E097D4 /* Pods_WSCloudStorageTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C5594E35B4878F485430036 /* Pods_WSCloudStorageTests.framework */; };
 /* End PBXBuildFile section */
 
@@ -393,6 +394,7 @@
 		ACF539F91F38038F00D4F08A /* BAKit_ConfigurationDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BAKit_ConfigurationDefine.h; sourceTree = "<group>"; };
 		ACF539FA1F38038F00D4F08A /* NSString+BAGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+BAGridView.h"; sourceTree = "<group>"; };
 		ACF539FB1F38038F00D4F08A /* NSString+BAGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+BAGridView.m"; sourceTree = "<group>"; };
+		ACF53A011F3806A700D4F08A /* gridviewtest.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gridviewtest.png; sourceTree = "<group>"; };
 		E57E3FA6D913300041C84BEB /* Pods-WSCloudStorageTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WSCloudStorageTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-WSCloudStorageTests/Pods-WSCloudStorageTests.release.xcconfig"; sourceTree = "<group>"; };
 		ECCBFB4328A8AB37C4E2AB84 /* Pods-WSCloudStorageUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WSCloudStorageUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-WSCloudStorageUITests/Pods-WSCloudStorageUITests.release.xcconfig"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -441,6 +443,7 @@
 		AC38D6031F331164000DD19D /* images */ = {
 			isa = PBXGroup;
 			children = (
+				ACF53A011F3806A700D4F08A /* gridviewtest.png */,
 				AC38D6041F3311E6000DD19D /* fav_download_normal@2x.png */,
 				AC38D6051F3311E6000DD19D /* fav_download_pressed@2x.png */,
 				AC38D6061F3311E6000DD19D /* fav_pause_normal@2x.png */,
@@ -1061,6 +1064,7 @@
 				AC38D65C1F3311E6000DD19D /* file_unknown_pressed@2x.png in Resources */,
 				AC38D65D1F3311E6000DD19D /* file_videofile_icon@2x.png in Resources */,
 				AC38D6341F3311E6000DD19D /* fav_download_normal@2x.png in Resources */,
+				ACF53A021F3806A700D4F08A /* gridviewtest.png in Resources */,
 				AC38D6461F3311E6000DD19D /* file_folder_icon@2x.png in Resources */,
 				AC38D6431F3311E6000DD19D /* file_down_rename_normal@2x.png in Resources */,
 				AC38D6551F3311E6000DD19D /* file_sort_n@2x.png in Resources */,

BIN
WSCloudStorage.xcworkspace/xcuserdata/jonathanh.xcuserdatad/UserInterfaceState.xcuserstate


+ 20 - 4
WSCloudStorage.xcworkspace/xcuserdata/jonathanh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -106,12 +106,28 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "WSCloudStorage/VC/TabBarMore/PreferencesViewController.m"
-            timestampString = "523730480.265236"
+            timestampString = "523779743.24527"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "50"
-            endingLineNumber = "50"
-            landmarkName = "-initSubViews"
+            startingLineNumber = "172"
+            endingLineNumber = "172"
+            landmarkName = "-tableView:cellForRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "WSCloudStorage/VC/TabBarMore/PreferencesViewController.m"
+            timestampString = "523778794.472501"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "61"
+            endingLineNumber = "61"
+            landmarkName = "-tableDataArray"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 13 - 2
WSCloudStorage/VC/TabBarMore/BAGridView/BAGridView.m

@@ -17,7 +17,7 @@ static NSString * const kCellID2 = @"BAGridViewTypeTitleDescCell";
 
 @interface BAGridView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
 
-@property(nonatomic, strong) UICollectionView *collectionView;
+@property(nonatomic, weak) UICollectionView *collectionView;
 
 @property(nonatomic, assign) CGFloat gridItem_w;
 @property(nonatomic, assign) CGFloat ba_gridView_lineWidth;
@@ -83,7 +83,18 @@ static NSString * const kCellID2 = @"BAGridViewTypeTitleDescCell";
 - (void)setupUI
 {
     self.backgroundColor = BAKit_Color_Clear_pod;
-    self.collectionView.hidden = NO;
+    UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new];
+    flowLayout.minimumLineSpacing = 0;
+    flowLayout.minimumInteritemSpacing = 0;
+    
+    UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
+    collectionView.backgroundColor = BAKit_Color_Clear_pod;
+    collectionView.dataSource = self;
+    collectionView.delegate = self;
+    collectionView.scrollEnabled = NO;
+    collectionView.hidden = NO;
+    [self addSubview:collectionView];
+    self.collectionView = collectionView;
     
     // 默认配置
     self.gridViewType = BAGridViewTypeImageTitle;

+ 113 - 11
WSCloudStorage/VC/TabBarMore/PreferencesViewController.m

@@ -8,7 +8,7 @@
 
 #import "PreferencesViewController.h"
 #import "BAKit_BAGridView.h"
-static NSString * const kCellID = @"ViewControllerCell";
+static NSString * const kCellID = @"PreferencesViewControllerCellID";
 #define AvatarWH 60
 #define ProgressH 8
 #define MaxX(view) CGRectGetMaxX(view.frame)
@@ -16,26 +16,68 @@ static NSString * const kCellID = @"ViewControllerCell";
 //#define MaxXPlus(MaxX(v),plusnumber) (MaxX(v) + plusnumber)
 //Avatar frame
 #define ScreenMarginTBLR 20
-@interface PreferencesViewController()//<UITableViewDelegate,UITableViewDataSource>
+
+
+//gridView
+#define kGridView_rowCount   4
+#define kGridView_itemHeight 100
+#define kGridView_H          BAKit_getColumnCountWithArrayAndRowCount_pod(self.gridDataArray, kGridView_rowCount) * kGridView_itemHeight
+@interface PreferencesViewController()<UITableViewDelegate,UITableViewDataSource>
 @property(nonatomic,weak)UIImageView *avatarview;
 @property(nonatomic,weak)UIProgressView *progressview;
 @property(nonatomic, weak)BAGridView *gridView;
-//@property(nonatomic,weak)UIView *gridView;//九宫格view,待自定义
+@property(nonatomic,strong)NSMutableArray *gridDataArray;
+
 @property(nonatomic,weak)UITableView *tableview;
+@property(nonatomic,strong)NSArray *tableDataArray;
 @end
 @implementation PreferencesViewController
+- (NSMutableArray <BAGridItemModel *> *)gridDataArray
+{
+    if (!_gridDataArray)
+    {
+        _gridDataArray = @[].mutableCopy;
+        
+        // 可以为本地图片
+        //        NSArray *imageNameArray = @[@"tabbar_mainframeHL", @"tabbar_mainframeHL", @"tabbar_mainframeHL", @"tabbar_mainframeHL", @"tabbar_mainframeHL"];
+        // 也可以是网络图片
+        NSArray *imageNameArray = @[@"gridviewtest.png", @"gridviewtest.png", @"gridviewtest.png", @"gridviewtest.png", @"gridviewtest.png"];
+        
+        NSArray *titleArray = @[@"测试", @"测试", @"测试", @"测试", @"测试"];
+        
+        for (NSInteger i = 0; i < titleArray.count; i++)
+        {
+            BAGridItemModel *model = [BAGridItemModel new];
+            model.imageName = imageNameArray[i];
+            model.placdholderImageName = @"tabbar_mainframeHL";
+            model.titleString = titleArray[i];
+            
+            [self.gridDataArray addObject:model];
+        }
+    }
+    return _gridDataArray;
+}
+-(NSArray *)tableDataArray{
+    if (!_tableDataArray) {
+        _tableDataArray = [[NSArray alloc]initWithObjects:@"设置",@"用户反馈",@"关于", nil];
+    }
+    return _tableDataArray;
+}
 -(void)viewDidLoad{
     [super viewDidLoad];
+    self.view.backgroundColor = RGB(243, 243, 245);
     self.navigationController.navigationBar.hidden = YES;
     [self initSubViews];
+    [self initData];
 }
 -(void)initSubViews{
     //|----|namelabel
     //|头像 |progress
     //|____|descritionlabel
     CGFloat screenW = SCREEN_WIDTH;
+    CGFloat screenH = SCREEN_HEIGHT;
     CGFloat residualRightW;
-    CGFloat residualRightH;
+    CGFloat residualRightH;//可用户布局  剩余高度
     UIImageView *avatarview = [[UIImageView alloc]init];
     avatarview.layer.cornerRadius = AvatarWH/2;
     avatarview.layer.masksToBounds = YES;
@@ -66,15 +108,75 @@ static NSString * const kCellID = @"ViewControllerCell";
     descritionlab.backgroundColor = [UIColor grayColor];
     descritionlab.frame = CGRectMake(progressview.origin.x, CGRectGetMaxY(progressview.frame), residualRightW, 30);
     [self.view addSubview:descritionlab];
-    UIView *gridView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(avatarview.frame)+20, screenW, 200)];
-    gridView.backgroundColor = [UIColor blueColor];
-    [self.view addSubview:gridView];
-    self.gridView = gridView;
     
-    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(gridView.frame), screenW, 300) style:UITableViewStylePlain];
-    tableView.separatorColor = [UIColor clearColor];
+
+    BAGridView *gridview = [BAGridView ba_creatGridViewWithGridViewType:BAGridViewTypeImageTitle dataArray:self.gridDataArray configurationBlock:^(BAGridView *tempView) {
+        
+        // 是否显示分割线
+        tempView.showLineView = YES;
+        // item:分割线颜色,默认:BAKit_Color_Gray_11【BAKit_Color_RGB(248, 248, 248)】
+        tempView.ba_gridView_lineColor = RGB(240, 240, 242);
+        // item:每行 item 的个数,默认为4个
+        tempView.ba_gridView_rowCount = kGridView_rowCount;
+        // item:高度
+        tempView.ba_gridView_itemHeight = kGridView_itemHeight;
+        // item:图片与文字间距(或者两行文字类型的间距),默认:0
+        //            tempView.ba_gridView_itemImageInset = 10;
+        //  item:title 颜色,默认:BAKit_Color_Black【[UIColor blackColor]】
+        //            tempView.ba_gridView_titleColor = BAKit_Color_Black;
+        // item:title Font,默认:图文样式下 16,两行文字下(上25,下12)
+        tempView.ba_gridView_titleFont = [UIFont boldSystemFontOfSize:15];
+        // item:背景颜色,默认:BAKit_Color_White
+        tempView.ba_gridView_backgroundColor = [UIColor whiteColor];
+        // item:背景选中颜色,默认:无色
+        tempView.ba_gridView_selectedBackgroundColor = BAKit_Color_Red_pod;
+        
+        self.gridView = tempView;
+        
+    } block:^(BAGridItemModel *model, NSIndexPath *indexPath) {
+        
+        //            BAKit_ShowAlertWithMsg_ios8(model.titleString);
+    }];
+    gridview.frame = CGRectMake(0, CGRectGetMaxY(avatarview.frame)+20, screenW, kGridView_H);
+    [self.view addSubview:gridview];
+    self.gridView = gridview;
+    
+    residualRightH =screenH - CGRectGetMaxY(gridview.frame) +20;
+    
+    
+    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(gridview.frame)+20, screenW, residualRightH) style:UITableViewStylePlain];
+    //footview
+    UIView *footview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, screenW, 54)];
+    UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
+    [exitBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
+    [exitBtn setTitle:@"退出账户" forState:UIControlStateNormal];
+    exitBtn.backgroundColor = [UIColor whiteColor];
+    exitBtn.frame = CGRectMake(0, 10, screenW, 44);
+    
+    [footview addSubview:exitBtn];
+    tableView.backgroundColor = [UIColor clearColor];
+    tableView.tableFooterView = footview;
     [self.view addSubview:tableView];
+    tableView.dataSource = self;
+    tableView.delegate = self;
     self.tableview = tableView;
 }
-
+-(void)initData{
+    [self.progressview setProgress:.34 animated:YES];
+}
+-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
+    return 3;
+}
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
+    if (!cell) {
+        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kCellID];
+    }
+    cell.textLabel.text = self.tableDataArray[indexPath.row];
+    return cell;
+}
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    NSLog(@"tap %@",indexPath);
+    NSLog(@"cell text: %@",[[[tableView cellForRowAtIndexPath:indexPath]textLabel]text]);
+}
 @end

BIN
WSCloudStorage/images/gridviewtest.png