Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit da57798

Browse files
终结MVC的Demo演练
1 parent 94fb027 commit da57798

File tree

20 files changed

+534
-62
lines changed

20 files changed

+534
-62
lines changed

‎MHDevelopExample/MHDevelopExample.xcodeproj/project.pbxproj‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
260C2DF71EF11A9200378885 /* SUWebView0Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 260C2DF61EF11A9200378885 /* SUWebView0Controller.m */; };
11+
260C2DFA1EF1261000378885 /* SUPublic0WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 260C2DF91EF1261000378885 /* SUPublic0WebViewController.m */; };
1012
260D8D841EED37CB00B47B3D /* SUGoods.m in Sources */ = {isa = PBXBuildFile; fileRef = 260D8D701EED37CB00B47B3D /* SUGoods.m */; };
1113
260D8D851EED37CB00B47B3D /* SUGoodsImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 260D8D721EED37CB00B47B3D /* SUGoodsImage.m */; };
1214
260D8D861EED37CB00B47B3D /* SUGoodsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 260D8D751EED37CB00B47B3D /* SUGoodsCell.m */; };
@@ -171,6 +173,10 @@
171173
/* End PBXContainerItemProxy section */
172174

173175
/* Begin PBXFileReference section */
176+
260C2DF51EF11A9200378885 /* SUWebView0Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUWebView0Controller.h; sourceTree = "<group>"; };
177+
260C2DF61EF11A9200378885 /* SUWebView0Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUWebView0Controller.m; sourceTree = "<group>"; };
178+
260C2DF81EF1261000378885 /* SUPublic0WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPublic0WebViewController.h; sourceTree = "<group>"; };
179+
260C2DF91EF1261000378885 /* SUPublic0WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPublic0WebViewController.m; sourceTree = "<group>"; };
174180
260D8D6F1EED37CB00B47B3D /* SUGoods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUGoods.h; sourceTree = "<group>"; };
175181
260D8D701EED37CB00B47B3D /* SUGoods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUGoods.m; sourceTree = "<group>"; };
176182
260D8D711EED37CB00B47B3D /* SUGoodsImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUGoodsImage.h; sourceTree = "<group>"; };
@@ -713,6 +719,8 @@
713719
2615EC881EEE308200D6B473 /* SUView0Controller.m */,
714720
2615EC8A1EEE30D500D6B473 /* SUTableView0Controller.h */,
715721
2615EC8B1EEE30D500D6B473 /* SUTableView0Controller.m */,
722+
260C2DF51EF11A9200378885 /* SUWebView0Controller.h */,
723+
260C2DF61EF11A9200378885 /* SUWebView0Controller.m */,
716724
);
717725
path = MVC;
718726
sourceTree = "<group>";
@@ -815,6 +823,8 @@
815823
260E2E6C1EEFEBDD00A0A50D /* SUPublic0ViewController.h */,
816824
260E2E6D1EEFEBDD00A0A50D /* SUPublic0ViewController.m */,
817825
260E2E6E1EEFEBDD00A0A50D /* SUPublic0ViewController.xib */,
826+
260C2DF81EF1261000378885 /* SUPublic0WebViewController.h */,
827+
260C2DF91EF1261000378885 /* SUPublic0WebViewController.m */,
818828
);
819829
path = Public;
820830
sourceTree = "<group>";
@@ -2046,6 +2056,7 @@
20462056
2615EC891EEE308200D6B473 /* SUView0Controller.m in Sources */,
20472057
622BF5F01E56E88A004DFCA2 /* MHYouKuAnthologyItem.m in Sources */,
20482058
2615ECCE1EEE919900D6B473 /* TAAnimatedDotView.m in Sources */,
2059+
260C2DFA1EF1261000378885 /* SUPublic0WebViewController.m in Sources */,
20492060
260F3BDC1EEEF91100ACF0D5 /* SUBanner.m in Sources */,
20502061
625B73BD1E4C598C006A8E86 /* NSDate+Extension.m in Sources */,
20512062
2615EC831EEE2E3000D6B473 /* SUViewController.m in Sources */,
@@ -2061,6 +2072,7 @@
20612072
2615ECCD1EEE919900D6B473 /* TAAbstractDotView.m in Sources */,
20622073
2615ECBC1EEE7DB200D6B473 /* SUSearchBarView.m in Sources */,
20632074
2615EC821EEE2E3000D6B473 /* SUTableViewController.m in Sources */,
2075+
260C2DF71EF11A9200378885 /* SUWebView0Controller.m in Sources */,
20642076
260D8DD01EEDA4D100B47B3D /* SUTableViewModel.m in Sources */,
20652077
260D8D841EED37CB00B47B3D /* SUGoods.m in Sources */,
20662078
627A951B1E4968E0004A1ED2 /* AppDelegate.m in Sources */,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "home_page_scroll_to_top@2x.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"filename" : "home_page_scroll_to_top@3x.png",
15+
"scale" : "3x"
16+
}
17+
],
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
21+
}
22+
}
15.1 KB
Loading[フレーム]
28.2 KB
Loading[フレーム]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "su_default_goods_detail@2x.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"filename" : "su_default_goods_detail@3x.png",
15+
"scale" : "3x"
16+
}
17+
],
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
21+
}
22+
}
34.2 KB
Loading[フレーム]
58.7 KB
Loading[フレーム]

‎MHDevelopExample/MHDevelopExample/Classes/MVC&MVVM/Base/BaseView/SUGoodsCell.h‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ typedef void(^SUGoodsCellPictureClickedHandler)(SUGoodsCell *goodsCell, NSIntege
2424
/**
2525
* 头像被点击
2626
*/
27-
typedef void(^SUGoodsCellAvatarClickedHandler)(SUGoodsCell *goodsCell);
27+
typedef void(^SUGoodsCellAvatarClickedHandler)(SUGoodsCell *goodsCell , NSString *userId);
2828

2929
/**
3030
* 位置被点击
3131
*/
32-
typedef void(^SUGoodsCellLocationClickedHandler)(SUGoodsCell *goodsCell);
32+
typedef void(^SUGoodsCellLocationClickedHandler)(SUGoodsCell *goodsCell , NSString *locationAreaName);
3333

3434
/**
3535
* 留言被点击
3636
*/
37-
typedef void(^SUGoodsCellReplyClickedHandler)(SUGoodsCell *goodsCell);
37+
typedef void(^SUGoodsCellReplyClickedHandler)(SUGoodsCell *goodsCell , NSString *goodsId);
3838

3939
/**
4040
* 点赞被点击
4141
*/
42-
typedef void(^SUGoodsCellThumbClickedHandler)(SUGoodsCell *goodsCell);
42+
typedef void(^SUGoodsCellThumbClickedHandler)(SUGoodsCell *goodsCell , NSString *goodsId);
4343

4444
//// 以上 MVC 和 MVVM without RAC 的事件回调的使用的场景,如果使用MVVM With RAC的请自行ignore
4545

@@ -66,7 +66,6 @@ typedef void(^SUGoodsCellThumbClickedHandler)(SUGoodsCell *goodsCell);
6666
@property (nonatomic, readwrite, copy) SUGoodsCellReplyClickedHandler replyClickedHandler;
6767
/// 点赞按钮被点击
6868
@property (nonatomic, readwrite, copy) SUGoodsCellThumbClickedHandler thumbClickedHandler;
69-
7069
//// 以上 MVC 和 MVVM without RAC 的事件回调的使用的场景,如果使用MVVM With RAC的请自行ignore
7170

7271
@end

‎MHDevelopExample/MHDevelopExample/Classes/MVC&MVVM/Base/BaseView/SUGoodsCell.m‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,27 +231,31 @@ - (void)setGoodsFrame:(SUGoodsFrame *)goodsFrame{
231231
- (void)_addActionDealForMVCOrMVVMWithoutRAC
232232
{
233233
/// 头像被点击
234+
@weakify(self);
234235
[self.userHeadImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] bk_initWithHandler:^(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location) {
235-
236+
@strongify(self);
237+
!self.avatarClickedHandler?:self.avatarClickedHandler(self , self.goodsFrame.goods.userId);
236238
}]];
237239

238240
/// 位置被点击
239241
[self.GPSBtn bk_addEventHandler:^(id sender) {
240-
242+
@strongify(self);
243+
!self.locationClickedHandler?:self.locationClickedHandler(self , self.goodsFrame.goods.locationAreaName);
241244
} forControlEvents:UIControlEventTouchUpInside];
242245

243246

244247
/// 回复按钮被点击
245248
[self.replyBtn bk_addEventHandler:^(id sender) {
246-
249+
@strongify(self);
250+
!self.replyClickedHandler?:self.replyClickedHandler(self , self.goodsFrame.goods.goodsId);
247251
} forControlEvents:UIControlEventTouchUpInside];
248252

249253

250254
/// 收藏按钮被点击
251255
[self.thumbBtn bk_addEventHandler:^(id sender) {
252-
256+
@strongify(self);
257+
!self.thumbClickedHandler?:self.thumbClickedHandler(self , self.goodsFrame.goods.goodsId);
253258
} forControlEvents:UIControlEventTouchUpInside];
254-
255259
}
256260
//// 以上 MVC 和 MVVM without RAC 的事件回调的使用的场景,如果使用MVVM With RAC的请自行ignore
257261

‎MHDevelopExample/MHDevelopExample/Classes/MVC&MVVM/Base/BaseView/SULoginInputView.xib‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<nil key="textColor"/>
2525
<nil key="highlightedColor"/>
2626
</label>
27-
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DnX-pd-bCs" userLabel="PhoneTextField">
27+
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号码" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing"translatesAutoresizingMaskIntoConstraints="NO" id="DnX-pd-bCs" userLabel="PhoneTextField">
2828
<rect key="frame" x="67" y="2" width="298" height="50"/>
2929
<constraints>
3030
<constraint firstAttribute="height" constant="50" id="yFg-nf-5uW"/>
@@ -52,7 +52,7 @@
5252
<nil key="textColor"/>
5353
<nil key="highlightedColor"/>
5454
</label>
55-
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6yx-EN-BJW" userLabel="VerifyCodeTextField">
55+
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing"translatesAutoresizingMaskIntoConstraints="NO" id="6yx-EN-BJW" userLabel="VerifyCodeTextField">
5656
<rect key="frame" x="67" y="2" width="298" height="50"/>
5757
<constraints>
5858
<constraint firstAttribute="height" constant="50" id="cuF-lc-MrD"/>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /