Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
8e437981
Commit
8e437981
authored
Sep 02, 2015
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
刷新
parent
616b25d5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
31 deletions
+56
-31
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+6
-6
IBTCommon.h
XFFruit/Utilities/IBTUIKit/IBTCommon.h
+1
-1
IBTCommon.m
XFFruit/Utilities/IBTUIKit/IBTCommon.m
+5
-0
IBTConstants.h
XFFruit/Utilities/IBTUIKit/IBTConstants.h
+3
-1
ChooseProductViewController.m
...trollers/Survey/controllers/ChooseProductViewController.m
+38
-23
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+1
-0
SurveyViewController.m
...ViewControllers/Survey/controllers/SurveyViewController.m
+2
-0
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
8e437981
...
...
@@ -2602,7 +2602,7 @@
IPHONEOS_DEPLOYMENT_TARGET
=
7.0
;
MTL_ENABLE_DEBUG_INFO
=
YES
;
ONLY_ACTIVE_ARCH
=
YES
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
SDKROOT
=
iphoneos
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
...
...
@@ -2640,7 +2640,7 @@
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
7.0
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
SDKROOT
=
iphoneos
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
...
...
@@ -2664,7 +2664,7 @@
"$(PROJECT_DIR)"
,
);
PRODUCT_NAME
=
XFFruit
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
name
=
Debug
;
...
...
@@ -2685,7 +2685,7 @@
"$(PROJECT_DIR)"
,
);
PRODUCT_NAME
=
XFFruit
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
name
=
Release
;
...
...
@@ -2708,7 +2708,7 @@
INFOPLIST_FILE
=
XFFruitTests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_NAME
=
XFFruitTests
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
...
...
@@ -2728,7 +2728,7 @@
INFOPLIST_FILE
=
XFFruitTests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_NAME
=
XFFruitTests
;
PROVISIONING_PROFILE
=
"
251ce065-a08f-44fd-bd52-f79372f4e47e
"
;
PROVISIONING_PROFILE
=
"
a12432a9-50b3-4cef-bae7-dcb35f965ce4
"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"
;
USER_HEADER_SEARCH_PATHS
=
"${SRCROOT}/**"
;
};
...
...
XFFruit/Utilities/IBTUIKit/IBTCommon.h
View file @
8e437981
...
...
@@ -37,5 +37,5 @@
+
(
NSString
*
)
dictionaryToJson
:(
id
)
dic
;
+
(
NSString
*
)
checkString
:(
NSString
*
)
str
;
+
(
NSMutableAttributedString
*
)
setTextViewFontOfString
:(
NSString
*
)
string
paragraphStyle
:(
NSInteger
)
lineHeight
fontSize
:(
float
)
size
color
:(
UIColor
*
)
color
;
+
(
NSString
*
)
trimmingCharacters
:(
NSString
*
)
str
;
@end
XFFruit/Utilities/IBTUIKit/IBTCommon.m
View file @
8e437981
...
...
@@ -206,5 +206,10 @@
return
attributeStr
;
}
+
(
NSString
*
)
trimmingCharacters
:
(
NSString
*
)
str
{
NSString
*
newStr
=
[
str
stringByTrimmingCharactersInSet
:[
NSCharacterSet
whitespaceCharacterSet
]];
return
newStr
;
}
@end
XFFruit/Utilities/IBTUIKit/IBTConstants.h
View file @
8e437981
...
...
@@ -109,6 +109,8 @@
#define GXF_SIXTEENTEH_SIZE FontSize(16)
#define GXF_SEVENTEENTH_SIZE FontSize(17)
//refreshUpdateDate
#define SurveyUpdateDate @"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate"
#endif
XFFruit/ViewControllers/Survey/controllers/ChooseProductViewController.m
View file @
8e437981
...
...
@@ -26,9 +26,13 @@
@end
@implementation
ChooseProductViewController
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
boxValueChanged
:
)
name
:
UITextFieldTextDidChangeNotification
object
:
nil
];
self
.
title
=
@"选择商品"
;
[
self
initData
];
[
self
bulidLayout
];
//刷新
...
...
@@ -38,7 +42,7 @@
self
.
dataArr
=
[
NSMutableArray
array
];
_indexArr
=
[
NSMutableArray
array
];
[
self
fetchProductList
];
[
self
fetchProductList
:
@""
];
}
-
(
void
)
createRefresh
{
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
...
...
@@ -46,17 +50,18 @@
return
;
}
_isRefresh
=
YES
;
[
self
get
Data
];
[
self
get
BaseDataFromLocal
];
}];
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChooseProductUpdateDate
;
}
-
(
void
)
get
Data
{
-
(
void
)
get
BaseDataFromLocal
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
endRefreshing
];
[
strongSelf
fetchProductList
];
[
strongSelf
fetchProductList
:
@""
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
...
...
@@ -71,19 +76,23 @@
[
self
.
tableView
.
header
endRefreshing
];
}
#pragma mark -成功
-
(
void
)
fetchProductList
{
-
(
void
)
fetchProductList
:
(
NSString
*
)
titleStr
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Product
TableName
],
@"uuid"
];
NSString
*
sql
=
@""
;
if
(
titleStr
.
length
>
0
)
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@"
,
[
Product
TableName
],
titleStr
,
@"uuid"
];
}
else
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Product
TableName
],
@"uuid"
];
}
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
NSLog
(
@"=====%@"
,
fetchedObjects
);
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
[
strongSelf
tableViewRefresh
];
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
...
...
@@ -98,7 +107,9 @@
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
returnKeyType
=
UIReturnKeyDone
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
_selectTextFiled
addTarget
:
self
action
:
@selector
(
boxValueChanged
:
)
forControlEvents
:
UIControlEventValueChanged
];
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
...
...
@@ -142,9 +153,6 @@
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
[
_indexArr
removeAllObjects
];
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
}
#pragma mark - 协议方法
...
...
@@ -197,23 +205,12 @@
if
(
!
[
self
isHaveIndexPath
:
indexPath
])
{
[
_indexArr
addObject
:
indexPath
];
}
NSString
*
personStr
=
@""
;
for
(
NSIndexPath
*
index
in
_indexArr
)
{
Product
*
product
=
self
.
dataArr
[
index
.
row
];
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@、"
,
product
.
name
];
}
_selectTextFiled
.
text
=
personStr
;
}
else
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
currentCell
.
Commitbtn
.
hidden
=
YES
;
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
Product
*
procuct
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
procuct
.
name
;
}
}
...
...
@@ -229,6 +226,24 @@
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
#pragma mark - 按钮事件
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
_selectTextFiled
.
text
];
[
self
fetchProductList
:
tilkeStr
];
[
self
tableViewRefresh
];
}
-
(
void
)
tableViewRefresh
{
[
self
.
tableView
reloadData
];
_currentIndexPath
=
nil
;
}
#pragma mark - hideKeyBoard
-
(
void
)
keyboardHidden
{
[
_selectTextFiled
resignFirstResponder
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
}
...
...
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
8e437981
...
...
@@ -361,6 +361,7 @@ typedef enum : NSUInteger {
[
self
PushViewController
:
cvc
animated
:
YES
];
}
else
if
(
indexPath
.
row
==
1
){
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
cvc
.
choseProduct
=
^
(
Product
*
product
){
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
_productLabel
.
textColor
=
GXF_CONTENT_COLOR
;
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
View file @
8e437981
...
...
@@ -77,6 +77,8 @@ typedef enum : NSUInteger {
_currentPage
=
0
;
[
self
getData
];
}];
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
SurveyUpdateDate
;
self
.
tableView
.
footer
=
[
MJRefreshAutoNormalFooter
footerWithRefreshingBlock
:
^
{
if
(
_isLoadMore
)
{
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment