Commit 7b25932f authored by admin's avatar admin

完成问题与知识列表 图说口碑列表布局

parent cff96300
......@@ -8,6 +8,9 @@
/* Begin PBXBuildFile section */
2381E9EBA834CB171E43657A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 083F3F95EB690FA24FEC0C8E /* libPods.a */; };
8408261A1BE5CEDD0022B795 /* OnLineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840826191BE5CEDD0022B795 /* OnLineViewController.m */; };
8408261E1BE5D22A0022B795 /* OnLineTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8408261D1BE5D22A0022B795 /* OnLineTableViewCell.m */; };
840826211BE5D2400022B795 /* OnLineFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 840826201BE5D2400022B795 /* OnLineFooterView.m */; };
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */; };
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */; };
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */; };
......@@ -28,6 +31,8 @@
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 84970E231BD8DEFE00C1728A /* AppDelegate.m */; };
84970E361BD8E09D00C1728A /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84970E351BD8E09D00C1728A /* LoginViewController.m */; };
84970E391BD8E0B300C1728A /* LoginView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84970E381BD8E0B300C1728A /* LoginView.m */; };
84AB20A51BE648EC00B66F13 /* PictureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AB20A41BE648EC00B66F13 /* PictureViewController.m */; };
84AB20A91BE64DC600B66F13 /* PictureTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AB20A81BE64DC600B66F13 /* PictureTableCell.m */; };
84C582EC1BDDFB0400AF838D /* HomeFunctionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C582EB1BDDFB0400AF838D /* HomeFunctionCell.m */; };
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; };
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574C1BDB344900083584 /* UIView+Frame.m */; };
......@@ -37,6 +42,9 @@
84DB06111BE33F33003E581E /* NewAnnounceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB06101BE33F33003E581E /* NewAnnounceCell.m */; };
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */; };
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */; };
84F166931BE6FF470061D350 /* QuestionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F166921BE6FF470061D350 /* QuestionViewController.m */; };
84F166971BE6FF710061D350 /* QuestionListTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F166961BE6FF710061D350 /* QuestionListTableCell.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84FD89F21BD9FC71006E442A /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD89F11BD9FC71006E442A /* HomeViewController.m */; };
84FD8A071BDA01C4006E442A /* ChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A061BDA01C4006E442A /* ChartViewController.m */; };
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A091BDA01D1006E442A /* MineViewController.m */; };
......@@ -63,6 +71,12 @@
083F3F95EB690FA24FEC0C8E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
13B0DDED3E0E584D79B395CF /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
6C6D8B0ECF8531E34D0DFF6B /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
840826181BE5CEDD0022B795 /* OnLineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineViewController.h; sourceTree = "<group>"; };
840826191BE5CEDD0022B795 /* OnLineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineViewController.m; sourceTree = "<group>"; };
8408261C1BE5D22A0022B795 /* OnLineTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineTableViewCell.h; sourceTree = "<group>"; };
8408261D1BE5D22A0022B795 /* OnLineTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineTableViewCell.m; sourceTree = "<group>"; };
8408261F1BE5D2400022B795 /* OnLineFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnLineFooterView.h; sourceTree = "<group>"; };
840826201BE5D2400022B795 /* OnLineFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineFooterView.m; sourceTree = "<group>"; };
840ABECA1BE1C29F006E49C5 /* RankDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailViewController.h; sourceTree = "<group>"; };
840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailViewController.m; sourceTree = "<group>"; };
840ABECD1BE20A53006E49C5 /* RankShopDetialCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankShopDetialCell.h; sourceTree = "<group>"; };
......@@ -105,6 +119,10 @@
84970E371BD8E0B300C1728A /* LoginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginView.h; sourceTree = "<group>"; };
84970E381BD8E0B300C1728A /* LoginView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginView.m; sourceTree = "<group>"; };
84970E3F1BD9127A00C1728A /* Constant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constant.h; sourceTree = "<group>"; };
84AB20A31BE648EC00B66F13 /* PictureViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureViewController.h; sourceTree = "<group>"; };
84AB20A41BE648EC00B66F13 /* PictureViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureViewController.m; sourceTree = "<group>"; };
84AB20A71BE64DC600B66F13 /* PictureTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureTableCell.h; sourceTree = "<group>"; };
84AB20A81BE64DC600B66F13 /* PictureTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureTableCell.m; sourceTree = "<group>"; };
84C582EA1BDDFB0400AF838D /* HomeFunctionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeFunctionCell.h; sourceTree = "<group>"; };
84C582EB1BDDFB0400AF838D /* HomeFunctionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeFunctionCell.m; sourceTree = "<group>"; };
84C957491BDB344900083584 /* UIBarButtonItem+Create.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Create.h"; sourceTree = "<group>"; };
......@@ -124,6 +142,12 @@
84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomDropMenuView.m; sourceTree = "<group>"; };
84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = "<group>"; };
84F166911BE6FF470061D350 /* QuestionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionViewController.h; sourceTree = "<group>"; };
84F166921BE6FF470061D350 /* QuestionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuestionViewController.m; sourceTree = "<group>"; };
84F166951BE6FF710061D350 /* QuestionListTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionListTableCell.h; sourceTree = "<group>"; };
84F166961BE6FF710061D350 /* QuestionListTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuestionListTableCell.m; sourceTree = "<group>"; };
84F166991BE715E40061D350 /* ZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZanButton.h; sourceTree = "<group>"; };
84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; };
84FD89F01BD9FC71006E442A /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; };
84FD89F11BD9FC71006E442A /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; };
84FD8A051BDA01C4006E442A /* ChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartViewController.h; sourceTree = "<group>"; };
......@@ -167,6 +191,15 @@
name = Pods;
sourceTree = "<group>";
};
8408261B1BE5D2130022B795 /* Cell */ = {
isa = PBXGroup;
children = (
8408261C1BE5D22A0022B795 /* OnLineTableViewCell.h */,
8408261D1BE5D22A0022B795 /* OnLineTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
8426A4A01BDF0CD600E5FDF5 /* Function */ = {
isa = PBXGroup;
children = (
......@@ -206,6 +239,7 @@
8426A4A41BDF0CD600E5FDF5 /* OnLine */ = {
isa = PBXGroup;
children = (
8408261B1BE5D2130022B795 /* Cell */,
8426A4A51BDF0CD600E5FDF5 /* View */,
8426A4A61BDF0CD600E5FDF5 /* ViewController */,
);
......@@ -215,6 +249,8 @@
8426A4A51BDF0CD600E5FDF5 /* View */ = {
isa = PBXGroup;
children = (
8408261F1BE5D2400022B795 /* OnLineFooterView.h */,
840826201BE5D2400022B795 /* OnLineFooterView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -222,6 +258,8 @@
8426A4A61BDF0CD600E5FDF5 /* ViewController */ = {
isa = PBXGroup;
children = (
840826181BE5CEDD0022B795 /* OnLineViewController.h */,
840826191BE5CEDD0022B795 /* OnLineViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
......@@ -229,6 +267,7 @@
8426A4A71BDF0CD600E5FDF5 /* Picture */ = {
isa = PBXGroup;
children = (
84AB20A61BE64D9800B66F13 /* Cell */,
8426A4A81BDF0CD600E5FDF5 /* View */,
8426A4A91BDF0CD600E5FDF5 /* ViewController */,
);
......@@ -245,6 +284,8 @@
8426A4A91BDF0CD600E5FDF5 /* ViewController */ = {
isa = PBXGroup;
children = (
84AB20A31BE648EC00B66F13 /* PictureViewController.h */,
84AB20A41BE648EC00B66F13 /* PictureViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
......@@ -252,6 +293,7 @@
8426A4AA1BDF0CD600E5FDF5 /* Question */ = {
isa = PBXGroup;
children = (
84F166941BE6FF580061D350 /* Cell */,
8426A4AB1BDF0CD600E5FDF5 /* View */,
8426A4AC1BDF0CD600E5FDF5 /* ViewController */,
);
......@@ -268,6 +310,8 @@
8426A4AC1BDF0CD600E5FDF5 /* ViewController */ = {
isa = PBXGroup;
children = (
84F166911BE6FF470061D350 /* QuestionViewController.h */,
84F166921BE6FF470061D350 /* QuestionViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
......@@ -534,6 +578,7 @@
84970E261BD8DEFE00C1728A /* Tools */ = {
isa = PBXGroup;
children = (
84F166981BE715D20061D350 /* ZanButton */,
84DB9BC11BDCD49900822CC4 /* CustomDropMenu */,
);
path = Tools;
......@@ -581,6 +626,15 @@
path = Macro;
sourceTree = "<group>";
};
84AB20A61BE64D9800B66F13 /* Cell */ = {
isa = PBXGroup;
children = (
84AB20A71BE64DC600B66F13 /* PictureTableCell.h */,
84AB20A81BE64DC600B66F13 /* PictureTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
84C582E91BDDFACD00AF838D /* Cell */ = {
isa = PBXGroup;
children = (
......@@ -649,6 +703,24 @@
path = CustomDropMenu;
sourceTree = "<group>";
};
84F166941BE6FF580061D350 /* Cell */ = {
isa = PBXGroup;
children = (
84F166951BE6FF710061D350 /* QuestionListTableCell.h */,
84F166961BE6FF710061D350 /* QuestionListTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
84F166981BE715D20061D350 /* ZanButton */ = {
isa = PBXGroup;
children = (
84F166991BE715E40061D350 /* ZanButton.h */,
84F1669A1BE715E40061D350 /* ZanButton.m */,
);
path = ZanButton;
sourceTree = "<group>";
};
84FD89ED1BD9FC5B006E442A /* Home */ = {
isa = PBXGroup;
children = (
......@@ -904,6 +976,7 @@
buildActionMask = 2147483647;
files = (
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */,
84AB20A91BE64DC600B66F13 /* PictureTableCell.m in Sources */,
84C582EC1BDDFB0400AF838D /* HomeFunctionCell.m in Sources */,
84970E361BD8E09D00C1728A /* LoginViewController.m in Sources */,
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */,
......@@ -916,14 +989,20 @@
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */,
84D8257F1BDD2F7E00CC61F7 /* MineTableFooterView.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
84AB20A51BE648EC00B66F13 /* PictureViewController.m in Sources */,
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */,
848699B31BDF810900859DFE /* InspectTaskViewController.m in Sources */,
848699B11BDF810900859DFE /* MenuButton.m in Sources */,
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */,
840826211BE5D2400022B795 /* OnLineFooterView.m in Sources */,
84DB06111BE33F33003E581E /* NewAnnounceCell.m in Sources */,
8408261E1BE5D22A0022B795 /* OnLineTableViewCell.m in Sources */,
8408261A1BE5CEDD0022B795 /* OnLineViewController.m in Sources */,
84C957551BDB54D600083584 /* AnnounceViewController.m in Sources */,
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
84F166971BE6FF710061D350 /* QuestionListTableCell.m in Sources */,
84970E391BD8E0B300C1728A /* LoginView.m in Sources */,
84F166931BE6FF470061D350 /* QuestionViewController.m in Sources */,
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */,
84846E9A1BE07CDF0010550A /* RankingListCell.m in Sources */,
848699B61BDF812F00859DFE /* RankingListViewController.m in Sources */,
......@@ -931,6 +1010,7 @@
84FD89F21BD9FC71006E442A /* HomeViewController.m in Sources */,
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */,
8442BA5C1BDB8FDB005E5657 /* MineTableHeaderView.m in Sources */,
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "textbox@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "textbox@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "commend@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "commend@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "commend_after@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "commend_after@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "comment@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "comment@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "comment_after@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "comment_after@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -82,6 +82,31 @@
#define kProgressViewAllBackColor [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1.0]
#define kProgressViewAlreadyBackColor [UIColor colorWithRed:112 / 255.0 green:120 / 255.0 blue:216 / 255.0 alpha:1.0]
// OnLine
// #444444
#define kOnLineCellTitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// #bbbbbb
#define kOnLineCellDetailColor [UIColor colorWithRed:187 / 255.0 green:187 / 255.0 blue:187 / 255.0 alpha:1.0]
// #f6f6f6
#define kFootViewBackGroundColor [UIColor colorWithRed:246 / 255.0 green:246 / 255.0 blue:246 / 255.0 alpha:1.0]
// Picture
#define kPictureCellTitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
#define kPictureCellDetailsColor [UIColor colorWithRed:83 / 255.0 green:83 / 255.0 blue:83 / 255.0 alpha:1.0]
#define kPictureCellDateColor [UIColor colorWithRed:135 / 255.0 green:135 / 255.0 blue:135 / 255.0 alpha:1.0]
// Question
// #444444
#define kQuestionCellTitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// #fe6903
#define kHotBackGroundColor [UIColor colorWithRed:254 / 255.0 green:105 / 255.0 blue:3 / 255.0 alpha:1.0]
// #999999
#define kQuestionStateColor [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1.0]
#import "UIView+Extension.h"
......
//
// OnLineTableViewCell.h
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OnLineTableViewCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *selectLabel;
@end
//
// OnLineTableViewCell.m
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "OnLineTableViewCell.h"
@implementation OnLineTableViewCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark - Private Methods
- (void)setup
{
self.titleLabel.textColor = kOnLineCellTitleColor;
self.selectLabel.textColor = kOnLineCellDetailColor;
}
#pragma mark - lazy loading
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.font = [UIFont systemFontOfSize:16.0];
[self.contentView addSubview:_titleLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.selectLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleBottom];
}
return _titleLabel;
}
#pragma mark - lazy loading
- (UILabel *)selectLabel
{
if (!_selectLabel) {
_selectLabel = [[UILabel alloc] init];
_selectLabel.textAlignment = NSTextAlignmentRight;
_selectLabel.text = @"请选择";
_selectLabel.translatesAutoresizingMaskIntoConstraints = NO;
_selectLabel.font = [UIFont systemFontOfSize:15.0];
[self.contentView addSubview:_selectLabel];
// 顶端
NSLayoutConstraint *selectTop = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:selectTop];
// 左边
NSLayoutConstraint *selectRight = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:selectRight];
// 右边
NSLayoutConstraint *selectWidth = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self.contentView addConstraint:selectWidth];
// 高度
NSLayoutConstraint *selectBottom = [NSLayoutConstraint constraintWithItem:_selectLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:selectBottom];
}
return _selectLabel;
}
@end
//
// OnLineFooterView.h
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OnLineFooterView : UIView
@property (nonatomic, strong) UITextView *titleTextView;
@property (nonatomic, strong) UITextView *contentTextView;
@property (nonatomic, strong) UIButton *saveButton;
@end
//
// OnLineFooterView.m
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "OnLineFooterView.h"
@interface OnLineFooterView () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UIImageView *backImageView2;
@property (nonatomic, strong) UILabel *placeholderLabel1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@end
@implementation OnLineFooterView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
self.backgroundColor = kFootViewBackGroundColor;
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.font = [UIFont systemFontOfSize:16.0];
titleLabel.text = @"任务标题";
titleLabel.textColor = kOnLineCellTitleColor;
[self addSubview:titleLabel];
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:titleTop];
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:titleLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self addConstraint:titleHeight];
UILabel *contentLabel = [[UILabel alloc] init];
contentLabel.translatesAutoresizingMaskIntoConstraints = NO;
contentLabel.font = [UIFont systemFontOfSize:16.0];
contentLabel.text = @"任务标题";
contentLabel.textColor = kOnLineCellTitleColor;
[self addSubview:contentLabel];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:contentLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:110];
[self addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:contentLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:contentLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:contentLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self addConstraint:contentHeight];
UIImage *image = [UIImage imageNamed:@"textbox"];
UIImage *resizingName = [image resizableImageWithCapInsets:UIEdgeInsetsMake(1, 1, 24, 24) resizingMode:UIImageResizingModeStretch];
self.backImageView1.image = resizingName;
self.backImageView2.image = resizingName;
self.titleTextView.backgroundColor = [UIColor clearColor];
self.contentTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel1.text = @"请输入文字...";
self.placeholderLabel2.text = @"请输入文字...";
[self.saveButton setTitle:@"保存并下达" forState:UIControlStateNormal];
}
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (![text isEqualToString:@""]) {
if (textView.tag == 1001) {
_placeholderLabel1.hidden = YES;
} else {
_placeholderLabel2.hidden = YES;
}
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
if (textView.tag == 1001) {
_placeholderLabel1.hidden = NO;
} else {
_placeholderLabel2.hidden = NO;
}
}
return YES;
}
#pragma mark - lazy loading
- (UIImageView *)backImageView1
{
if (!_backImageView1) {
_backImageView1 = [[UIImageView alloc] init];
_backImageView1.userInteractionEnabled = YES;
_backImageView1.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backImageView1];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:50];
[self addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self addConstraint:contentHeight];
}
return _backImageView1;
}
- (UIImageView *)backImageView2
{
if (!_backImageView2) {
_backImageView2 = [[UIImageView alloc] init];
_backImageView2.userInteractionEnabled = YES;
_backImageView2.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backImageView2];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_backImageView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:160];
[self addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_backImageView2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_backImageView2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_backImageView2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:120];
[self addConstraint:contentHeight];
}
return _backImageView2;
}
- (UITextView *)titleTextView
{
if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init];
_titleTextView.tag = 1001;
_titleTextView.delegate = self;
_titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.backImageView1 addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:1];
[self.backImageView1 addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeRight multiplier:1.0 constant:-1];
[self.backImageView1 addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.backImageView1 addConstraint:contentHeight];
}
return _titleTextView;
}
- (UITextView *)contentTextView
{
if (!_contentTextView) {
_contentTextView = [[UITextView alloc] init];
_contentTextView.tag = 1002;
_contentTextView.font = [UIFont systemFontOfSize:15.0];
_contentTextView.delegate = self;
_contentTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView2 addSubview:_contentTextView];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_contentTextView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backImageView2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.backImageView2 addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_contentTextView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backImageView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:1];
[self.backImageView2 addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_contentTextView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backImageView2 attribute:NSLayoutAttributeRight multiplier:1.0 constant:-1];
[self.backImageView2 addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_contentTextView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backImageView2 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.backImageView2 addConstraint:contentHeight];
}
return _contentTextView;
}
- (UILabel *)placeholderLabel1
{
if (!_placeholderLabel1) {
_placeholderLabel1 = [[UILabel alloc] init];
_placeholderLabel1.translatesAutoresizingMaskIntoConstraints = NO;
_placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
_placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.titleTextView addSubview:_placeholderLabel1];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.titleTextView addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:5];
[self.titleTextView addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.titleTextView addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.titleTextView addConstraint:contentHeight];
}
return _placeholderLabel1;
}
- (UILabel *)placeholderLabel2
{
if (!_placeholderLabel2) {
_placeholderLabel2 = [[UILabel alloc] init];
_placeholderLabel2.translatesAutoresizingMaskIntoConstraints = NO;
_placeholderLabel2.font = [UIFont systemFontOfSize:15.0];
_placeholderLabel2.textColor = kOnLineCellDetailColor;
[self.contentTextView addSubview:_placeholderLabel2];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_placeholderLabel2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentTextView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentTextView addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_placeholderLabel2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentTextView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:5];
[self.contentTextView addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_placeholderLabel2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentTextView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentTextView addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_placeholderLabel2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentTextView addConstraint:contentHeight];
}
return _placeholderLabel2;
}
- (UIButton *)saveButton
{
if (!_saveButton) {
_saveButton = [[UIButton alloc] init];
_saveButton.backgroundColor = kNavigationBarColor;
_saveButton.layer.cornerRadius = 5;
_saveButton.layer.masksToBounds = YES;
_saveButton.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_saveButton];
NSLayoutConstraint *saveBottom = [NSLayoutConstraint constraintWithItem:_saveButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-20];
[self addConstraint:saveBottom];
NSLayoutConstraint *saveLeft = [NSLayoutConstraint constraintWithItem:_saveButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:saveLeft];
NSLayoutConstraint *saveRight = [NSLayoutConstraint constraintWithItem:_saveButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:saveRight];
NSLayoutConstraint *saveHeight = [NSLayoutConstraint constraintWithItem:_saveButton attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:saveHeight];
}
return _saveButton;
}
@end
//
// OnLineViewController.h
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OnLineViewController : UIViewController
@end
//
// OnLineViewController.m
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "OnLineViewController.h"
#import "OnLineTableViewCell.h"
#import "OnLineFooterView.h"
#define kOnLineTableViewCell @"onlineTableViewCell"
@interface OnLineViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) OnLineFooterView *footView;
@end
@implementation OnLineViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"发起抽查任务"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
self.titleArray = [NSArray arrayWithObjects:@"商场名称", @"截止时间", nil];
[self addTableView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Methods
- (void)addTableView
{
[self.tableView registerClass:[OnLineTableViewCell class] forCellReuseIdentifier:kOnLineTableViewCell];
self.tableView.tableFooterView = self.footView;
}
- (void)saveClick:(UIButton *)sender
{
NSLog(@"保存并下达");
}
#pragma mark - TableView Delegate/DateSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _titleArray.count;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
OnLineTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kOnLineTableViewCell];
if (!cell) {
cell = [[OnLineTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kOnLineTableViewCell];
}
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
- (OnLineFooterView *)footView
{
if (!_footView) {
if (kScreenHeight == 480) {
_footView = [[OnLineFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 400)];
} else {
_footView = [[OnLineFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, (kScreenHeight - 100 - 63))];
}
[_footView.saveButton addTarget:self action:@selector(saveClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _footView;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// PictureTableCell.h
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZanButton.h"
@interface PictureTableCell : UITableViewCell
@property (nonatomic, strong) UIImageView *titleImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailsLabel;
@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) ZanButton *thumbBtn;
@property (nonatomic, strong) ZanButton *commentBtn;
@end
//
// PictureTableCell.m
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureTableCell.h"
@interface PictureTableCell ()
@property (nonatomic, strong) UILabel *hotLabel;
@end
@implementation PictureTableCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.titleImageView.image = [UIImage imageNamed:@""];
self.titleLabel.textColor = kPictureCellTitleColor;
self.hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
self.detailsLabel.textColor = kPictureCellDetailsColor;
self.dateLabel.textColor = kPictureCellDateColor;
self.thumbBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
self.commentBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
}
#pragma mark - Lazy loading
- (UIImageView *)titleImageView
{
if (!_titleImageView) {
_titleImageView = [[UIImageView alloc] init];
_titleImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleImageView];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_titleImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:18];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_titleImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:15];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_titleImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:85];
[self.contentView addConstraint:titleImageWidth];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_titleImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:titleImageHeight];
}
return _titleImageView;
}
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:17.0];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:16];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.hotLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:titleImageHeight];
}
return _titleLabel;
}
- (UILabel *)hotLabel
{
if (!_hotLabel) {
_hotLabel = [[UILabel alloc] init];
_hotLabel.translatesAutoresizingMaskIntoConstraints = NO;
_hotLabel.backgroundColor = kHotBackGroundColor;
_hotLabel.textColor = [UIColor whiteColor];
_hotLabel.text = @"HOT";
_hotLabel.textAlignment = NSTextAlignmentCenter;
_hotLabel.layer.masksToBounds = YES;
_hotLabel.layer.cornerRadius = 3;
[self.contentView addSubview:_hotLabel];
// 顶端
NSLayoutConstraint *hotTop = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:20];
[self.contentView addConstraint:hotTop];
// 左边
NSLayoutConstraint *hotWidth = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:34];
[self.contentView addConstraint:hotWidth];
// 右边
NSLayoutConstraint *hotRight = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:hotRight];
// 高度
NSLayoutConstraint *hotHeight = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:15];
[self.contentView addConstraint:hotHeight];
}
return _hotLabel;
}
- (UILabel *)detailsLabel
{
if (!_detailsLabel) {
_detailsLabel = [[UILabel alloc] init];
_detailsLabel.font = [UIFont systemFontOfSize:15.0];
_detailsLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailsLabel.numberOfLines = 0;
[self.contentView addSubview:_detailsLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:10];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[self.contentView addConstraint:titleImageHeight];
}
return _detailsLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc] init];
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
_dateLabel.font = [UIFont systemFontOfSize:14.0];
[self.contentView addSubview:_dateLabel];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:15];
[self.contentView addConstraint:titleImageLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.thumbBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self.contentView addConstraint:titleImageHeight];
}
return _dateLabel;
}
- (ZanButton *)thumbBtn
{
if (!_thumbBtn) {
_thumbBtn = [[ZanButton alloc] init];
[_thumbBtn setImage:[UIImage imageNamed:@"commend"] forState:UIControlStateNormal];
_thumbBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_thumbBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[self.contentView addSubview:_thumbBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.commentBtn attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:titleImageWidth];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.commentBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:titleImageHeight];
}
return _thumbBtn;
}
- (ZanButton *)commentBtn
{
if (!_commentBtn) {
_commentBtn = [[ZanButton alloc] init];
[_commentBtn setImage:[UIImage imageNamed:@"comment"] forState:UIControlStateNormal];
_commentBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_commentBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[self.contentView addSubview:_commentBtn];
NSLayoutConstraint *titleImageTop = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
[self.contentView addConstraint:titleImageTop];
NSLayoutConstraint *titleImageWidth = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:titleImageWidth];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_commentBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:titleImageHeight];
}
return _commentBtn;
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// PictureViewController.h
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PictureViewController : UIViewController
@end
//
// PictureViewController.m
// redstar
//
// Created by admin on 15/11/1.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "PictureViewController.h"
#import "MenuButton.h"
#import "PictureTableCell.h"
#define kPictureTableViewCell @"pictureTabelViewCell"
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *test1Array;
@property (nonatomic, strong) NSArray *test2Array;
@property (nonatomic, strong) NSArray *test3Array;
@end
@implementation PictureViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self setupNav];
[self setupTableView];
// 初始化
self.test1Array = [NSArray arrayWithObjects:@"【服务口碑现场】第二期",@"讲述红星人自己的故事",@"【服务口碑现场】第一期", nil];
self.test2Array = [NSArray arrayWithObjects:@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。",@"变成商场服务提升的契机,变成商场服务提升的契机。",@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。", nil];
self.test3Array = [NSArray arrayWithObjects:@"2015-08-26",@"2015-08-09",@"2015-07-31", nil];
}
#pragma mark - Private Methods
- (void)setupNav
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"图说口碑"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 20)];
[rightButton setTitle:@"我要新增" forState:UIControlStateNormal];
[rightButton addTarget:self action:@selector(addClick:) forControlEvents:UIControlEventTouchUpInside];
[rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem = rightButtonItem;
}
- (void)setupTableView
{
[self.tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kPictureTableViewCell];
}
- (void)addClick:(UIButton *)sender
{
NSLog(@"我要新增");
}
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _test1Array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kPictureTableViewCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTableViewCell];
}
cell.titleLabel.text = _test1Array[indexPath.row];
cell.detailsLabel.text = _test2Array[indexPath.row];
cell.dateLabel.text = [NSString stringWithFormat:@"发布时间: %@", _test3Array[indexPath.row]];
[cell.thumbBtn setTitle:@"220" forState:UIControlStateNormal];
[cell.commentBtn setTitle:@"18" forState:UIControlStateNormal];
return cell;
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 123;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 45;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0;
}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = kInspectSectionBackGroundColor;
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
lineView.backgroundColor = kSeparateLineColor;
[sectionView addSubview:lineView];
NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:lineTop];
NSLayoutConstraint *lineLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-0.5];
[sectionView addConstraint:lineLeft];
NSLayoutConstraint *lineWidth = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[sectionView addConstraint:lineWidth];
NSLayoutConstraint *lineBottom = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:lineBottom];
MenuButton *taxiButton = [[MenuButton alloc] init];
taxiButton.translatesAutoresizingMaskIntoConstraints = NO;
[taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[taxiButton setImage:[UIImage imageNamed:@"sort_icon"] forState:UIControlStateNormal];
taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[taxiButton setTitle:@"排序" forState:UIControlStateNormal];
[sectionView addSubview:taxiButton];
MenuButton *screenButton = [[MenuButton alloc] init];
screenButton.translatesAutoresizingMaskIntoConstraints = NO;
[screenButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[screenButton setImage:[UIImage imageNamed:@"filter_icon"] forState:UIControlStateNormal];
screenButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[screenButton setTitle:@"筛选" forState:UIControlStateNormal];
[sectionView addSubview:screenButton];
// taxiButton布局
NSLayoutConstraint *taxiButtonTop = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonTop];
NSLayoutConstraint *taxiButtonLeft = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonLeft];
NSLayoutConstraint *taxiButtonWidth = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:screenButton attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonWidth];
NSLayoutConstraint *taxiButtonBottom = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonBottom];
// screenButton布局
NSLayoutConstraint *screenButtonTop = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonTop];
NSLayoutConstraint *screenButtonRight = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonRight];
NSLayoutConstraint *screenButtonLeft = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:taxiButton attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonLeft];
NSLayoutConstraint *screenButtonBottom = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonBottom];
return sectionView;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// QuestionListTableCell.h
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZanButton.h"
@interface QuestionListTableCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel; // 标题
@property (nonatomic, strong) UILabel *hotLabel; // hot
@property (nonatomic, strong) UILabel *detailsLabel; // 副标题
@property (nonatomic, strong) UILabel *stateLabel; // 分类
@property (nonatomic, strong) UILabel *dateLabel; // 时间
@property (nonatomic, strong) ZanButton *thumbBtn; // 点赞
@end
//
// QuestionListTableCell.m
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "QuestionListTableCell.h"
@implementation QuestionListTableCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.titleLabel.textColor = kQuestionCellTitleColor;
self.hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
self.detailsLabel.font = [UIFont systemFontOfSize:15.0];
self.stateLabel.font = [UIFont systemFontOfSize:14.0];
self.dateLabel.font = [UIFont systemFontOfSize:14.0];
self.thumbBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
}
#pragma mark - lazy laoding
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.font = [UIFont boldSystemFontOfSize:17.0];
[self.contentView addSubview:_titleLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.hotLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-15];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:titleHeight];
}
return _titleLabel;
}
- (UILabel *)hotLabel
{
if (!_hotLabel) {
_hotLabel = [[UILabel alloc] init];
_hotLabel.translatesAutoresizingMaskIntoConstraints = NO;
_hotLabel.backgroundColor = kHotBackGroundColor;
_hotLabel.textColor = [UIColor whiteColor];
_hotLabel.text = @"HOT";
_hotLabel.textAlignment = NSTextAlignmentCenter;
_hotLabel.layer.masksToBounds = YES;
_hotLabel.layer.cornerRadius = 3;
[self.contentView addSubview:_hotLabel];
// 顶端
NSLayoutConstraint *hotTop = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:15];
[self.contentView addConstraint:hotTop];
// 左边
NSLayoutConstraint *hotWidth = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:34];
[self.contentView addConstraint:hotWidth];
// 右边
NSLayoutConstraint *hotRight = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:hotRight];
// 高度
NSLayoutConstraint *hotHeight = [NSLayoutConstraint constraintWithItem:_hotLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:15];
[self.contentView addConstraint:hotHeight];
}
return _hotLabel;
}
- (UILabel *)detailsLabel
{
if (!_detailsLabel) {
_detailsLabel = [[UILabel alloc] init];
_detailsLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailsLabel.textColor = kQuestionCellTitleColor;
[self.contentView addSubview:_detailsLabel];
// 顶端
NSLayoutConstraint *detailsTop = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:detailsTop];
// 左边
NSLayoutConstraint *detailsLeft = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:detailsLeft];
// 右边
NSLayoutConstraint *detailsRight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:detailsRight];
// 高度
NSLayoutConstraint *detailsHeight = [NSLayoutConstraint constraintWithItem:_detailsLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:detailsHeight];
}
return _detailsLabel;
}
- (UILabel *)stateLabel
{
if (!_stateLabel) {
_stateLabel = [[UILabel alloc] init];
_stateLabel.translatesAutoresizingMaskIntoConstraints = NO;
_stateLabel.textColor = kQuestionStateColor;
[self.contentView addSubview:_stateLabel];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.detailsLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:3];
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateLeft = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:stateLeft];
// 右边
NSLayoutConstraint *stateRight = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:stateRight];
// 高度
NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_stateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:16];
[self.contentView addConstraint:stateHeight];
}
return _stateLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc] init];
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
_dateLabel.textColor = kQuestionStateColor;
[self.contentView addSubview:_dateLabel];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.stateLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateLeft = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:stateLeft];
// 右边
NSLayoutConstraint *stateRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.thumbBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:stateRight];
// 高度
NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:16];
[self.contentView addConstraint:stateHeight];
}
return _dateLabel;
}
- (ZanButton *)thumbBtn
{
if (!_thumbBtn) {
_thumbBtn = [[ZanButton alloc] init];
_thumbBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_thumbBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[_thumbBtn setTitle:@"220" forState:UIControlStateNormal];
[_thumbBtn setImage:[UIImage imageNamed:@"commend"] forState:UIControlStateNormal];
[self.contentView addSubview:_thumbBtn];
// 顶端
NSLayoutConstraint *stateTop = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.stateLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:2];
[self.contentView addConstraint:stateTop];
// 左边
NSLayoutConstraint *stateWidth = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:55];
[self.contentView addConstraint:stateWidth];
// 右边
NSLayoutConstraint *stateRight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:stateRight];
// 高度
NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_thumbBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:stateHeight];
}
return _thumbBtn;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// QuestionViewController.h
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface QuestionViewController : UIViewController
@end
//
// QuestionViewController.m
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "QuestionViewController.h"
#import "QuestionListTableCell.h"
#import "MenuButton.h"
#define kQuestionListCell @"questionListTableViewCell"
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@end
@implementation QuestionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kQuestionListCell];
[self setupNav];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Methods
#pragma mark - Private Methods
- (void)setupNav
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"问题与知识"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 20)];
[rightButton setTitle:@"新增问题" forState:UIControlStateNormal];
[rightButton addTarget:self action:@selector(addClick:) forControlEvents:UIControlEventTouchUpInside];
[rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem = rightButtonItem;
}
- (void)addClick:(UIButton *)sender
{
}
#pragma mark - UItableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
QuestionListTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kQuestionListCell];
if (!cell) {
cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kQuestionListCell];
}
cell.titleLabel.text = @"系统跟单维护回访短信早于物流跟单送货";
cell.detailsLabel.text = @"新的SOP营业员跟单送货完成后的两天内未能及时返回,回访短信已经发送";
cell.stateLabel.text = @"服务 - 15分钟退单";
cell.dateLabel.text = @"提报时间:2015-09-10 08:10:18";
return cell;
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 120;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 45;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0;
}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = kInspectSectionBackGroundColor;
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
lineView.backgroundColor = kSeparateLineColor;
[sectionView addSubview:lineView];
NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:lineTop];
NSLayoutConstraint *lineLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-0.5];
[sectionView addConstraint:lineLeft];
NSLayoutConstraint *lineWidth = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[sectionView addConstraint:lineWidth];
NSLayoutConstraint *lineBottom = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:lineBottom];
MenuButton *taxiButton = [[MenuButton alloc] init];
taxiButton.translatesAutoresizingMaskIntoConstraints = NO;
[taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[taxiButton setImage:[UIImage imageNamed:@"sort_icon"] forState:UIControlStateNormal];
taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[taxiButton setTitle:@"排序" forState:UIControlStateNormal];
[sectionView addSubview:taxiButton];
MenuButton *screenButton = [[MenuButton alloc] init];
screenButton.translatesAutoresizingMaskIntoConstraints = NO;
[screenButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[screenButton setImage:[UIImage imageNamed:@"filter_icon"] forState:UIControlStateNormal];
screenButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[screenButton setTitle:@"筛选" forState:UIControlStateNormal];
[sectionView addSubview:screenButton];
// taxiButton布局
NSLayoutConstraint *taxiButtonTop = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonTop];
NSLayoutConstraint *taxiButtonLeft = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonLeft];
NSLayoutConstraint *taxiButtonWidth = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:screenButton attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonWidth];
NSLayoutConstraint *taxiButtonBottom = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:taxiButtonBottom];
// screenButton布局
NSLayoutConstraint *screenButtonTop = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonTop];
NSLayoutConstraint *screenButtonRight = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonRight];
NSLayoutConstraint *screenButtonLeft = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:taxiButton attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonLeft];
NSLayoutConstraint *screenButtonBottom = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:screenButtonBottom];
return sectionView;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -13,6 +13,9 @@
#import "InspectListViewController.h"
#import "RankingListViewController.h"
#import "OnLineViewController.h"
#import "PictureViewController.h"
#import "QuestionViewController.h"
#define kNewAnnounceCell @"NewAnnounceTableViewCell"
#define kHomeFunctionCell @"HomeFunctionCell"
......@@ -69,11 +72,15 @@
NSLog(@"查看全部公告···");
}
// 在线抽查或任务处理
- (void)onLineSamplingClick:(UIButton *)sender
{
OnLineViewController *onLineVC = [[OnLineViewController alloc] init];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:onLineVC animated:YES];
}
// 口碑列表 或口碑排名
- (void)wordOfMouthClick:(UIButton *)sender
{
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
......@@ -85,9 +92,12 @@
// [self.navigationController pushViewController:rankListVC animated:YES];
}
// 问题与知识
- (void)questionClick:(UIButton *)sender
{
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionVC animated:YES];
}
- (void)standardClick:(UIButton *)sender
......@@ -95,9 +105,12 @@
}
// 图说口碑
- (void)pictureClick:(UIButton *)sender
{
PictureViewController *pictureVC = [[PictureViewController alloc] init];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:pictureVC animated:YES];
}
- (void)caseClick:(UIButton *)sender
......
//
// ZanButton.h
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ZanButton : UIButton
@end
//
// ZanButton.m
// redstar
//
// Created by admin on 15/11/2.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "ZanButton.h"
@implementation ZanButton
// 修改按钮内部子控件的frame
- (void)layoutSubviews
{
[super layoutSubviews];
// 1.imageView
CGFloat imageX = 5;
CGFloat imageY = 0;
CGFloat imageW = 17;
CGFloat imageH = 18;
self.imageView.frame = CGRectMake(imageX, imageY, imageW, imageH);
// 2.title
CGFloat titleX = self.bounds.size.width / 2;
CGFloat titleY = 1;
CGFloat titleW = self.bounds.size.width / 2;
CGFloat titleH = self.bounds.size.height - titleY;
self.titleLabel.frame = CGRectMake(titleX, titleY, titleW, titleH);
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment