├── Playground ├── Assets.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ └── Contents.json ├── Resource │ ├── Image │ │ ├── logo.png │ │ ├── logo@2x.png │ │ ├── logo@3x.png │ │ ├── Bid │ │ │ ├── bid_fb.png │ │ │ ├── bid_tw.png │ │ │ ├── bid_desc.png │ │ │ ├── bid_fb@2x.png │ │ │ ├── bid_fb@3x.png │ │ │ ├── bid_photo.png │ │ │ ├── bid_reply.png │ │ │ ├── bid_tw@2x.png │ │ │ ├── bid_tw@3x.png │ │ │ ├── bid_comment.png │ │ │ ├── bid_desc@2x.png │ │ │ ├── bid_desc@3x.png │ │ │ ├── bid_photo@2x.png │ │ │ ├── bid_photo@3x.png │ │ │ ├── bid_reply@2x.png │ │ │ ├── bid_reply@3x.png │ │ │ ├── bid_comment@2x.png │ │ │ ├── bid_comment@3x.png │ │ │ ├── bid_desc_selected.png │ │ │ ├── bid_comment_selected.png │ │ │ ├── bid_desc_selected@2x.png │ │ │ ├── bid_desc_selected@3x.png │ │ │ ├── bid_photo_selected.png │ │ │ ├── bid_photo_selected@2x.png │ │ │ ├── bid_photo_selected@3x.png │ │ │ ├── bid_comment_selected@2x.png │ │ │ └── bid_comment_selected@3x.png │ │ ├── Item │ │ │ ├── red_bg.png │ │ │ ├── blue_bg.png │ │ │ ├── orange_bg.png │ │ │ ├── purple_bg.png │ │ │ ├── red_bg@2x.png │ │ │ ├── red_bg@3x.png │ │ │ ├── yellow_bg.png │ │ │ ├── blue_bg@2x.png │ │ │ ├── blue_bg@3x.png │ │ │ ├── img_default.png │ │ │ ├── orange_bg@2x.png │ │ │ ├── orange_bg@3x.png │ │ │ ├── purple_bg@2x.png │ │ │ ├── purple_bg@3x.png │ │ │ ├── yellow_bg@2x.png │ │ │ └── yellow_bg@3x.png │ │ ├── Category │ │ │ ├── ct00.png │ │ │ ├── ct01.png │ │ │ ├── ct02.png │ │ │ ├── ct03.png │ │ │ ├── ct04.png │ │ │ ├── ct05.png │ │ │ ├── ct06.png │ │ │ ├── ct00@2x.png │ │ │ ├── ct00@3x.png │ │ │ ├── ct01@2x.png │ │ │ ├── ct01@3x.png │ │ │ ├── ct02@2x.png │ │ │ ├── ct02@3x.png │ │ │ ├── ct03@2x.png │ │ │ ├── ct03@3x.png │ │ │ ├── ct04@2x.png │ │ │ ├── ct04@3x.png │ │ │ ├── ct05@2x.png │ │ │ ├── ct05@3x.png │ │ │ ├── ct06@2x.png │ │ │ └── ct06@3x.png │ │ ├── Tabbar │ │ │ ├── tab_oval.png │ │ │ ├── tab_category.png │ │ │ ├── tab_oval@2x.png │ │ │ ├── tab_oval@3x.png │ │ │ ├── tab_profile.png │ │ │ ├── tab_profile@2x.png │ │ │ ├── tab_profile@3x.png │ │ │ ├── tab_category@2x.png │ │ │ └── tab_category@3x.png │ │ ├── Login │ │ │ ├── login_crown.png │ │ │ ├── login_crown@2x.png │ │ │ ├── login_crown@3x.png │ │ │ ├── login_login_bg.png │ │ │ ├── login_gradient_bg.png │ │ │ ├── login_login_bg@2x.png │ │ │ ├── login_login_bg@3x.png │ │ │ ├── login_playground.png │ │ │ ├── login_gradient_bg@2x.png │ │ │ ├── login_gradient_bg@3x.png │ │ │ ├── login_playground@2x.png │ │ │ └── login_playground@3x.png │ │ ├── Profile │ │ │ ├── rate_star.png │ │ │ ├── inbox_setting.png │ │ │ ├── profile_mail.png │ │ │ ├── rate_star@2x.png │ │ │ ├── rate_star@3x.png │ │ │ ├── inbox_setting@2x.png │ │ │ ├── inbox_setting@3x.png │ │ │ ├── profile_mail@2x.png │ │ │ ├── profile_mail@3x.png │ │ │ ├── profile_setting.png │ │ │ ├── profile_setting@2x.png │ │ │ ├── profile_setting@3x.png │ │ │ ├── rate_star_disable.png │ │ │ ├── rate_star_disable@2x.png │ │ │ └── rate_star_disable@3x.png │ │ ├── Signup │ │ │ ├── navbar_back.png │ │ │ ├── upload_add.png │ │ │ ├── navbar_back@2x.png │ │ │ ├── navbar_back@3x.png │ │ │ ├── upload_add@2x.png │ │ │ └── upload_add@3x.png │ │ └── Auction │ │ │ ├── auct_congrat.png │ │ │ ├── auct_congrat@2x.png │ │ │ └── auct_congrat@3x.png │ ├── Font │ │ ├── MyriadPro-Black.otf │ │ ├── MyriadPro-Bold.otf │ │ ├── MyriadPro-Light.otf │ │ ├── MyriadPro-Regular.otf │ │ └── MyriadPro-Semibold.otf │ └── Category.plist ├── Model │ ├── BaseModelData.m │ ├── BaseModelData.h │ ├── InboxData.h │ ├── BidData.h │ ├── CategoryData.h │ ├── CommentData.h │ ├── InboxData.m │ ├── BidData.m │ ├── CategoryData.m │ ├── UserData.h │ ├── CommentData.m │ ├── ItemData.h │ └── UserData.m ├── View │ ├── BidViewController │ │ ├── BidPhotoCell.h │ │ ├── BidNoCommentCell.h │ │ ├── BidDescCell.h │ │ ├── BidPhotoCollectionCell.h │ │ ├── BidItemCell.h │ │ ├── BidCommentCell.h │ │ ├── BidInputViewController │ │ │ └── BidInputViewController.h │ │ ├── BidViewController.h │ │ ├── BidPhotoCell.m │ │ ├── BidNoCommentCell.m │ │ ├── BidPhotoCollectionCell.m │ │ ├── BidCommentCell.m │ │ ├── BidItemCell.m │ │ └── BidDescCell.m │ ├── CustomUI │ │ ├── PCTextField │ │ │ ├── PCTextField.h │ │ │ └── PCTextField.m │ │ ├── PCBaseView │ │ │ ├── PCBaseView.h │ │ │ └── PCBaseView.m │ │ ├── PCBorderView │ │ │ ├── PCBorderView.h │ │ │ └── PCBorderView.m │ │ ├── PCNotice │ │ │ ├── PCNoticePrice │ │ │ │ ├── PCNoticePrice.h │ │ │ │ ├── PCNoticePrice.m │ │ │ │ └── PCNoticePrice.xib │ │ │ ├── PCNoticeTimeout │ │ │ │ ├── PCNoticeTimeout.h │ │ │ │ ├── PCNoticeTimeout.m │ │ │ │ └── PCNoticeTimeout.xib │ │ │ ├── PCNotice.h │ │ │ └── PCNotice.m │ │ ├── PCRateView │ │ │ ├── PCRateView.h │ │ │ └── PCRateView.m │ │ ├── PCItemView │ │ │ └── PCItemView.h │ │ ├── PCNavbarView │ │ │ ├── PCNavbarView.h │ │ │ └── PCNavbarView.m │ │ ├── PCUploadView │ │ │ ├── PCUploadView.h │ │ │ ├── PCUploadView.xib │ │ │ └── PCUploadViewBottom.xib │ │ └── PCAlertDialog │ │ │ ├── PCAlertDialog.h │ │ │ └── PCAlertDialog.m │ ├── MainTabbarController │ │ ├── MainTabbarController.h │ │ └── MainTabbarController.m │ ├── UploadViewController │ │ ├── UploadViewController.h │ │ ├── UploadCategoryViewController │ │ │ ├── UploadCategoryCell.h │ │ │ ├── UploadCategoryViewController.h │ │ │ ├── UploadCategoryCell.m │ │ │ └── UploadCategoryViewController.m │ │ └── UploadInputViewController │ │ │ └── UploadInputViewController.h │ ├── LoginViewController │ │ └── LoginViewController.h │ ├── ProfileViewController │ │ ├── ProfileViewController.h │ │ ├── ChatViewController │ │ │ ├── ChatViewController.h │ │ │ ├── ChatCell.h │ │ │ ├── ChatCell.m │ │ │ └── ChatViewController.m │ │ ├── InboxViewController │ │ │ ├── InboxViewController.h │ │ │ ├── InboxCell.h │ │ │ └── InboxCell.m │ │ ├── ProfileUserCell.h │ │ ├── ProfileStatisticsCell.h │ │ ├── RateViewController │ │ │ ├── RateViewController.h │ │ │ └── RateViewController.m │ │ ├── ProfileUserCell.m │ │ └── ProfileStatisticsCell.m │ ├── CategoryViewController │ │ ├── CategoryViewController.h │ │ ├── CategoryDetailViewController │ │ │ ├── CategoryDetailCell.h │ │ │ ├── ItemBaseCell.h │ │ │ ├── CategoryDetailViewController.h │ │ │ ├── CategoryDetailCell.m │ │ │ └── ItemBaseCell.m │ │ ├── CategoryCell.h │ │ ├── ItemCollectionCell.h │ │ ├── CategoryExploreCell.h │ │ ├── ItemCollectionCell.m │ │ ├── CategoryCell.m │ │ └── CategoryExploreCell.m │ ├── SettingsViewController │ │ ├── SettingsViewController.h │ │ ├── EditSettingViewController │ │ │ ├── EditSettingViewController.h │ │ │ └── EditSettingViewController.m │ │ ├── EditNotificationViewController │ │ │ ├── EditNotificationViewController.h │ │ │ └── EditNotificationViewController.m │ │ ├── EditProfileViewController │ │ │ └── EditProfileViewController.h │ │ └── SettingsViewController.m │ ├── LandingViewController │ │ ├── LandingViewController.h │ │ └── LandingViewController.m │ ├── SignupViewController │ │ └── SignupViewController.h │ ├── AuctionViewController │ │ └── AuctionViewController.h │ └── BaseViewController │ │ └── BaseViewController.h ├── AppDelegate.h ├── Helpers │ ├── PHColorHelper.h │ ├── PHDataHelper.h │ ├── PHTextHelper.h │ ├── PHColorHelper.m │ ├── PHUiHelper.h │ ├── PHDataHelper.m │ ├── PHTextHelper.m │ └── PHUiHelper.m ├── Lib │ └── PlaceholderTextView │ │ ├── PlaceholderTextView.h │ │ └── PlaceholderTextView.m ├── main.m ├── Utils │ ├── CommonUtils.h │ └── CommonUtils.m ├── ApiManager │ ├── ApiClientCore.h │ └── ApiConfig.h ├── Info.plist ├── AppDelegate.m └── Base.lproj │ └── LaunchScreen.storyboard ├── Playground.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── Administrator.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── Playground.xcscheme ├── Playground.xcworkspace └── contents.xcworkspacedata ├── Podfile ├── PlaygroundTests ├── Info.plist └── PlaygroundTests.m ├── PlaygroundUITests ├── Info.plist └── PlaygroundUITests.m ├── Podfile.lock ├── README.md └── .gitignore /Playground/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Playground/Resource/Image/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/logo.png -------------------------------------------------------------------------------- /Playground/Resource/Image/logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/logo@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/logo@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_fb.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_tw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_tw.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/red_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/red_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Font/MyriadPro-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Font/MyriadPro-Black.otf -------------------------------------------------------------------------------- /Playground/Resource/Font/MyriadPro-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Font/MyriadPro-Bold.otf -------------------------------------------------------------------------------- /Playground/Resource/Font/MyriadPro-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Font/MyriadPro-Light.otf -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_fb@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_fb@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_fb@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_fb@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_reply.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_tw@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_tw@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_tw@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_tw@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct00.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct01.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct02.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct03.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct04.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct05.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct06.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/blue_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/blue_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/orange_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/orange_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/purple_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/purple_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/red_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/red_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/red_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/red_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/yellow_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/yellow_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Font/MyriadPro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Font/MyriadPro-Regular.otf -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_reply@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_reply@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_reply@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_reply@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct00@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct00@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct00@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct00@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct01@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct01@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct01@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct02@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct02@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct02@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct02@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct03@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct03@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct03@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct03@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct04@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct04@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct04@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct04@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct05@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct05@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct05@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct05@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct06@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct06@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Category/ct06@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Category/ct06@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/blue_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/blue_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/blue_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/blue_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/img_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/img_default.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_oval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_oval.png -------------------------------------------------------------------------------- /Playground/Resource/Font/MyriadPro-Semibold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Font/MyriadPro-Semibold.otf -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/orange_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/orange_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/orange_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/orange_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/purple_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/purple_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/purple_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/purple_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/yellow_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/yellow_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Item/yellow_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Item/yellow_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_crown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_crown.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/navbar_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/navbar_back.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/upload_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/upload_add.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_category.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_oval@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_oval@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_oval@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_oval@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_profile.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Auction/auct_congrat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Auction/auct_congrat.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc_selected.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_crown@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_crown@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_crown@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_crown@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_login_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/inbox_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/inbox_setting.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_mail.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/navbar_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/navbar_back@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/navbar_back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/navbar_back@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/upload_add@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/upload_add@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Signup/upload_add@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Signup/upload_add@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_profile@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_profile@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_profile@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_profile@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Auction/auct_congrat@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Auction/auct_congrat@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Auction/auct_congrat@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Auction/auct_congrat@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment_selected.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc_selected@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_desc_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_desc_selected@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo_selected.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_gradient_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_gradient_bg.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_login_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_login_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_login_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_login_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_playground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_playground.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/inbox_setting@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/inbox_setting@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/inbox_setting@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/inbox_setting@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_mail@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_mail@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_mail@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_mail@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_setting.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_category@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_category@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Tabbar/tab_category@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Tabbar/tab_category@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo_selected@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_photo_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_photo_selected@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_gradient_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_gradient_bg@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_gradient_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_gradient_bg@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_playground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_playground@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Login/login_playground@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Login/login_playground@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_setting@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_setting@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/profile_setting@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/profile_setting@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star_disable.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment_selected@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Bid/bid_comment_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Bid/bid_comment_selected@3x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star_disable@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star_disable@2x.png -------------------------------------------------------------------------------- /Playground/Resource/Image/Profile/rate_star_disable@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Resource/Image/Profile/rate_star_disable@3x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highjump0615/Auction_iOS/HEAD/Playground/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /Playground.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Playground/Model/BaseModelData.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseModelData.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @implementation BaseModelData 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidPhotoCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidPhotoCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BidPhotoCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCTextField/PCTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // PLTextField.h 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PCTextField : UITextField 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidNoCommentCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidNoCommentCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/30/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BidNoCommentCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCBaseView/PCBaseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PCBaseView : UIView 12 | 13 | + (id)getView:(NSString *)nibName; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCBorderView/PCBorderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCBorderView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PCBorderView : UIView 12 | 13 | - (void)removeBottom; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/MainTabbarController/MainTabbarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainTabbarController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainTabbarController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/Model/BaseModelData.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseModelData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseModelData : NSObject 12 | 13 | @property (nonatomic) NSInteger id; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticePrice/PCNoticePrice.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCNoticePrice.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNotice.h" 10 | 11 | @interface PCNoticePrice : PCNotice 12 | 13 | + (id)getView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UploadViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface UploadViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidDescCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidDescCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BidDescCell : UITableViewCell 12 | 13 | - (void)fillContent:(id)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticeTimeout/PCNoticeTimeout.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCNoticeTimeout.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNotice.h" 10 | 11 | @interface PCNoticeTimeout : PCNotice 12 | 13 | + (id)getView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/LoginViewController/LoginViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoginViewController.h 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface LoginViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ProfileViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProfileViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ProfileViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface CategoryViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/SettingsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface SettingsViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryDetailViewController/CategoryDetailCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryDetailCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/14/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ItemBaseCell.h" 10 | 11 | @interface CategoryDetailCell : ItemBaseCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/LandingViewController/LandingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LandingViewController.h 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface LandingViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ChatViewController/ChatViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChatViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ChatViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/SignupViewController/SignupViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SignupViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "EditProfileViewController.h" 10 | 11 | @interface SignupViewController : EditProfileViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/InboxViewController/InboxViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // InboxViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface InboxViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ProfileUserCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProfileUserCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ProfileUserCell : UITableViewCell 12 | 13 | - (void)fillContent:(id)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ProfileStatisticsCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProfileStatisticsCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ProfileStatisticsCell : UITableViewCell 12 | 13 | - (void)fillContent:(id)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Playground 4 | // 5 | // Created by Administrator on 17/1/7. 6 | // Copyright © 2017年 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryDetailViewController/ItemBaseCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ItemBaseCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ItemBaseCell : UITableViewCell 12 | 13 | - (void)fillContent:(id)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/Helpers/PHColorHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // PHColorHelper.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PHColorHelper : NSObject 12 | 13 | + (UIColor*)colorTextGray; 14 | + (UIColor*)colorTextBlack; 15 | + (UIColor*)colorShadow; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCRateView/PCRateView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCRateView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @interface PCRateView : PCBaseView 12 | 13 | + (id)getView; 14 | - (NSInteger)getRate; 15 | - (void)setRate:(NSInteger)rate; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/EditSettingViewController/EditSettingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EditSettingViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface EditSettingViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/Lib/PlaceholderTextView/PlaceholderTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PlaceholderTextView.h 3 | // 4 | 5 | #import 6 | 7 | @interface PlaceholderTextView : UITextView 8 | 9 | @property (nonatomic, retain) NSString *placeholder; 10 | @property (nonatomic, retain) UIColor *placeholderColor; 11 | 12 | -(void)textChanged:(NSNotification*)notification; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidPhotoCollectionCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidPhotoCollectionCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BidPhotoCollectionCell : UICollectionViewCell 12 | 13 | - (void)fillContent:(NSString *)path; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidItemCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidItemCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BidItemCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) id delegate; 14 | 15 | - (void)fillContent:(id)data; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/RateViewController/RateViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RateViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface RateViewController : BaseViewController 12 | 13 | - (void)setItemData:(id)item; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/AuctionViewController/AuctionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AuctionViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/17/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface AuctionViewController : BaseViewController 12 | 13 | @property (weak, nonatomic) id mItemData; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CategoryData; 12 | 13 | @interface CategoryCell : UITableViewCell 14 | 15 | - (void)fillContent:(CategoryData *)category; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/EditNotificationViewController/EditNotificationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EditNotificationViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface EditNotificationViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidCommentCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidCommentCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ChatCell.h" 10 | 11 | @interface BidCommentCell : ChatCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *mButReply; 14 | 15 | - (void)fillContent:(id)data; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidInputViewController/BidInputViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidInputViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/17/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BidInputViewController : BaseViewController 12 | 13 | - (void)setItemData:(id)item; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/ItemCollectionCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCollectionCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ItemCollectionCell : UICollectionViewCell 12 | 13 | - (void)showTimeLimit:(BOOL)show; 14 | - (void)fillContent:(id)data; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Playground/Model/InboxData.h: -------------------------------------------------------------------------------- 1 | // 2 | // InboxData.h 3 | // Playground 4 | // 5 | // Created by Administrator on 2/25/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @class ItemData; 12 | 13 | @interface InboxData : BaseModelData 14 | 15 | @property (nonatomic, retain) ItemData *item; 16 | 17 | - (id)initWithDic:(NSDictionary *)data; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/InboxViewController/InboxCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // InboxCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ItemBaseCell.h" 10 | 11 | @interface InboxCell : ItemBaseCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *mButRate; 14 | 15 | - (void)fillContent:(id)data; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Playground 4 | // 5 | // Created by Administrator on 17/1/7. 6 | // Copyright © 2017年 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BidViewController : BaseViewController 12 | 13 | @property (weak, nonatomic) id mItemData; 14 | 15 | - (void)setSelectedTab:(int)value; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadCategoryViewController/UploadCategoryCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // UploadCategoryCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CategoryData; 12 | 13 | @interface UploadCategoryCell : UITableViewCell 14 | 15 | - (void)fillContent:(CategoryData *)category; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadCategoryViewController/UploadCategoryViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UploadCategoryViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface UploadCategoryViewController : BaseViewController 12 | 13 | @property (weak, nonatomic) id delegate; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Playground/Model/BidData.h: -------------------------------------------------------------------------------- 1 | // 2 | // BidData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 2/2/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @interface BidData : BaseModelData 12 | 13 | @property (nonatomic) NSInteger price; 14 | @property (nonatomic) NSInteger userId; 15 | @property (nonatomic, retain) NSDate *dateGiveup; 16 | 17 | - (id)initWithDic:(NSDictionary *)data; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Playground/Helpers/PHDataHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // PHDataHelper.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PHDataHelper : NSObject 12 | 13 | + (NSDate *)stringToDate:(NSString *)value format:(NSString *)format; 14 | + (NSString *)dateToString:(NSDate *)value format:(NSString *)format; 15 | + (BOOL)isObjectNull:(NSObject *)object; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryExploreCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryExploreCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CategoryExploreCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UICollectionView *mCollectionView; 14 | 15 | - (void)fillContent:(NSInteger)count; 16 | - (void)setNoticeText:(NSString *)value; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Playground/Model/CategoryData.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @interface CategoryData : BaseModelData 12 | 13 | @property (nonatomic, retain) NSString *name; 14 | 15 | + (NSInteger)getCount; 16 | + (CategoryData *)getItem:(NSInteger)index; 17 | 18 | - (id)initWithDictionary:(NSDictionary *)value; 19 | - (NSString *)getImageName; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryDetailViewController/CategoryDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryDetailViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/14/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @class CategoryData; 12 | 13 | @interface CategoryDetailViewController : BaseViewController 14 | 15 | @property (nonatomic, strong) CategoryData *mCategory; 16 | @property (nonatomic, strong) NSString *mstrSearch; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Playground/Utils/CommonUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // CommonUtils.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kApiToken @"api_token" 12 | #define kCurrentUser @"current_user" 13 | 14 | @class UserData; 15 | 16 | @interface CommonUtils : NSObject 17 | 18 | @property (nonatomic, retain) NSMutableArray *maryCategory; 19 | @property (nonatomic, retain) UserData *mCurrentUser; 20 | 21 | + (id)sharedObject; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Playground/Utils/CommonUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // CommonUtils.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CommonUtils.h" 10 | 11 | @implementation CommonUtils 12 | 13 | + (id)sharedObject { 14 | static CommonUtils *utils = nil; 15 | if (!utils) { 16 | utils = [[CommonUtils alloc] init]; 17 | 18 | // init 19 | utils.maryCategory = [[NSMutableArray alloc] init]; 20 | } 21 | 22 | return utils; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ChatViewController/ChatCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChatCell.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ChatCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *mLblTime; 14 | @property (weak, nonatomic) IBOutlet UILabel *mLblUsername; 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblBubble; 16 | 17 | - (void)showTime:(BOOL)show; 18 | - (void)showUsername:(BOOL)show; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidPhotoCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidPhotoCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidPhotoCell.h" 10 | 11 | @implementation BidPhotoCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 19 | [super setSelected:selected animated:animated]; 20 | 21 | // Configure the view for the selected state 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Playground/Model/CommentData.h: -------------------------------------------------------------------------------- 1 | // 2 | // CommentData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/30/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @interface CommentData : BaseModelData 12 | 13 | @property (nonatomic, retain) NSString *comment; 14 | @property (nonatomic, retain) NSString *username; 15 | @property (nonatomic, retain) CommentData *parent; 16 | @property (nonatomic, retain) NSDate *createdAt; 17 | 18 | - (id)initWithDic:(NSDictionary *)data; 19 | - (id)initWithText:(NSString *)comment parent:(CommentData *)parent; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCItemView/PCItemView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCItemView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @protocol PCItemViewDelegate 12 | 13 | @optional 14 | - (void)onImageItem:(NSInteger)index; 15 | 16 | @end 17 | 18 | @interface PCItemView : PCBaseView 19 | 20 | @property (weak, nonatomic) id delegate; 21 | 22 | + (id)getView; 23 | - (void)showTimeLimit:(BOOL)show; 24 | 25 | - (void)setItemData:(id)item; 26 | - (void)setUserData:(NSInteger)userId item:(id)item; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNavbarView/PCNavbarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSNavBarView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @interface PCNavbarView : PCBaseView 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *mButBack; 14 | @property (weak, nonatomic) IBOutlet UITextField *mTxtSearch; 15 | 16 | + (id)getView; 17 | - (void)showSearch:(BOOL)showSearch showBack:(BOOL)showBack; 18 | - (void)setTitle:(NSString *)value bold:(BOOL)bold; 19 | - (void)showTitle:(BOOL)show; 20 | - (void)showCongrat:(BOOL)show; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Playground/Model/InboxData.m: -------------------------------------------------------------------------------- 1 | // 2 | // InboxData.m 3 | // Playground 4 | // 5 | // Created by Administrator on 2/25/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "InboxData.h" 10 | #import "ItemData.h" 11 | 12 | @implementation InboxData 13 | 14 | - (id)initWithDic:(NSDictionary *)data { 15 | self = [super init]; 16 | 17 | if (self) { 18 | self.id = [[data valueForKey:@"id"] integerValue]; 19 | 20 | NSDictionary *dicItem = [data valueForKey:@"item"]; 21 | self.item = [[ItemData alloc] initWithDic:dicItem]; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCUploadView/PCUploadView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSUploadView.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | #define UPLOAD_VIEW_RIGHT 0 12 | #define UPLOAD_VIEW_BOTTOM 1 13 | 14 | @interface PCUploadView : PCBaseView 15 | 16 | + (id)getView:(int)mode controller:(UIViewController *)controller; 17 | 18 | - (void)setFrame:(CGRect)frame; 19 | - (UIImage *)getImage; 20 | - (void)setImage:(UIImage *)image fromUrl:(NSString *)path; 21 | - (UIImagePickerController *)getImagePicker; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadInputViewController/UploadInputViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UploadInputViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @class CategoryData; 12 | 13 | @interface UploadInputViewController : BaseViewController 14 | 15 | @property (nonatomic, strong) UIImage *mImgCover; 16 | @property (nonatomic, strong) UIImage *mImgPreview1; 17 | @property (nonatomic, strong) UIImage *mImgPreview2; 18 | @property (nonatomic, strong) UIImage *mImgPreview3; 19 | 20 | @property (nonatomic, strong) CategoryData *mCategory; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCAlertDialog/PCAlertDialog.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCAlertDialog.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/17/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @protocol PCAlertDialogDelegate 12 | 13 | @optional 14 | - (void)onButAlertPrimary; 15 | 16 | @end 17 | 18 | @interface PCAlertDialog : PCBaseView 19 | 20 | @property (weak, nonatomic) id delegate; 21 | 22 | + (id)getView; 23 | - (void)showView:(BOOL)bShow animated:(BOOL)animated; 24 | 25 | - (void)setTitle:(NSString *)value; 26 | - (void)setMessage:(NSString *)value; 27 | - (void)setPrimaryButName:(NSString *)value; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Playground' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for Playground 9 | pod 'TPKeyboardAvoiding' 10 | pod 'ActionSheetPicker-3.0' 11 | pod 'TTTAttributedLabel' 12 | pod 'SVProgressHUD' 13 | pod 'AFNetworking', '~> 3.0' 14 | pod 'SDWebImage', '~>3.8' 15 | 16 | target 'PlaygroundTests' do 17 | inherit! :search_paths 18 | # Pods for testing 19 | end 20 | 21 | target 'PlaygroundUITests' do 22 | inherit! :search_paths 23 | # Pods for testing 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNotice.h: -------------------------------------------------------------------------------- 1 | // 2 | // PCNotice.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @interface PCNotice : PCBaseView { 12 | double mdRadius; 13 | } 14 | 15 | @property (weak, nonatomic) IBOutlet UIImageView *mViewTimeBg; 16 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblValue; 18 | 19 | - (void)setShadow:(CGFloat)offset opacity:(CGFloat)opacity radius:(CGFloat)radius; 20 | 21 | - (void)setBackgroundImage:(UIImage *)image; 22 | - (void)setTitle:(NSString *)value; 23 | - (void)setValueText:(NSString *)value; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Playground/Model/BidData.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidData.m 3 | // Playground 4 | // 5 | // Created by Top1 on 2/2/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidData.h" 10 | #import "PHDataHelper.h" 11 | 12 | @implementation BidData 13 | 14 | - (id)initWithDic:(NSDictionary *)data { 15 | self = [super init]; 16 | 17 | if (self) { 18 | self.id = [[data valueForKey:@"id"] integerValue]; 19 | self.price = [[data valueForKey:@"price"] integerValue]; 20 | self.userId = [[data valueForKey:@"user_id"] integerValue]; 21 | self.dateGiveup = [PHDataHelper stringToDate:[data valueForKey:@"giveup_at"] format:@"yyyy-MM-dd HH:mm:ss"]; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/EditProfileViewController/EditProfileViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EditProfileViewController.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @class PCTextField; 12 | @class PCUploadView; 13 | 14 | @interface EditProfileViewController : BaseViewController { 15 | PCUploadView *mviewPhotoCore; 16 | NSInteger mnGender; 17 | NSDate *mDateBirthday; 18 | } 19 | 20 | @property (weak, nonatomic) IBOutlet UITextField *mTxtName; 21 | @property (weak, nonatomic) IBOutlet UITextField *mTxtUsername; 22 | 23 | - (void)initTextField:(UITextField *)textfield; 24 | - (NSData *)getImageData; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCBaseView/PCBaseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseView.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBaseView.h" 10 | 11 | @implementation PCBaseView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | + (id)getView:(NSString *)nibName { 22 | NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil]; 23 | PCBaseView *view = [[PCBaseView alloc] init]; 24 | view = (PCBaseView *)[nib objectAtIndex:0]; 25 | 26 | return view; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /PlaygroundTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /PlaygroundUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidNoCommentCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidNoCommentCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/30/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidNoCommentCell.h" 10 | #import "PHTextHelper.h" 11 | 12 | @interface BidNoCommentCell() 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *mLblNotice; 15 | 16 | @end 17 | 18 | @implementation BidNoCommentCell 19 | 20 | - (void)awakeFromNib { 21 | [super awakeFromNib]; 22 | 23 | // font 24 | [self.mLblNotice setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 25 | } 26 | 27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 28 | [super setSelected:selected animated:animated]; 29 | 30 | // Configure the view for the selected state 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Playground.xcodeproj/xcuserdata/Administrator.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Playground.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C3033FF11E2052BE00782925 16 | 17 | primary 18 | 19 | 20 | C303400A1E2052BE00782925 21 | 22 | primary 23 | 24 | 25 | C30340151E2052BE00782925 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Playground/Helpers/PHTextHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // PHTextHelper.h 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PHTextHelper : NSObject 12 | 13 | + (NSInteger)fontSizeSmall; 14 | + (NSInteger)fontSizeMedium; 15 | + (NSInteger)fontSizeNormal; 16 | + (NSInteger)fontSizeNormalLarge; 17 | + (NSInteger)fontSizeSemiLarge; 18 | + (NSInteger)fontSizeLarge; 19 | 20 | + (NSInteger)fontNoticeSmall; 21 | + (NSInteger)fontNoticeMedium; 22 | 23 | + (UIFont *)myriadProRegular:(CGFloat)size; 24 | + (UIFont *)myriadProBold:(CGFloat)size; 25 | + (UIFont*)myriadProBlack:(CGFloat)size; 26 | + (UIFont*)myriadProLight:(CGFloat)size; 27 | + (UIFont*)myriadProSemibold:(CGFloat)size; 28 | 29 | // textfield functions 30 | + (void)initTextRegular:(UITextField *)textfield; 31 | + (void)initTextBold:(UITextField *)textfield; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Playground/Helpers/PHColorHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // PHColorHelper.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PHColorHelper.h" 10 | 11 | @implementation PHColorHelper 12 | 13 | + (UIColor*)colorTextGray { 14 | return [UIColor colorWithRed:164/255.0 15 | green:170/255.0 16 | blue:179/255.0 17 | alpha:1.0]; 18 | } 19 | 20 | + (UIColor*)colorTextBlack { 21 | return [UIColor colorWithRed:53/255.0 22 | green:53/255.0 23 | blue:53/255.0 24 | alpha:1.0]; 25 | } 26 | 27 | + (UIColor*)colorShadow { 28 | return [UIColor colorWithRed:0.0 29 | green:0.0 30 | blue:0.0 31 | alpha:0.5]; 32 | } 33 | 34 | 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/ItemCollectionCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCollectionCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ItemCollectionCell.h" 10 | #import "PCItemView.h" 11 | #import "ItemData.h" 12 | 13 | @interface ItemCollectionCell() { 14 | PCItemView *mItemView; 15 | } 16 | 17 | @end 18 | 19 | @implementation ItemCollectionCell 20 | 21 | - (void)awakeFromNib { 22 | [super awakeFromNib]; 23 | 24 | // add item view 25 | mItemView = [PCItemView getView]; 26 | mItemView.frame = self.bounds; 27 | 28 | [self.contentView addSubview:mItemView]; 29 | } 30 | 31 | /** 32 | show/hide time limit on the bottom 33 | @param show <#show description#> 34 | */ 35 | - (void)showTimeLimit:(BOOL)show { 36 | [mItemView showTimeLimit:show]; 37 | } 38 | 39 | - (void)fillContent:(id)data { 40 | [mItemView setItemData:data]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadCategoryViewController/UploadCategoryCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // UploadCategoryCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "UploadCategoryCell.h" 10 | #import "PHTextHelper.h" 11 | #import "CategoryData.h" 12 | 13 | @interface UploadCategoryCell () 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblName; 16 | 17 | @end 18 | 19 | @implementation UploadCategoryCell 20 | 21 | - (void)awakeFromNib { 22 | [super awakeFromNib]; 23 | 24 | [self.mLblName setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 25 | } 26 | 27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 28 | [super setSelected:selected animated:animated]; 29 | 30 | // Configure the view for the selected state 31 | } 32 | 33 | - (void)fillContent:(CategoryData *)category { 34 | // set name 35 | [self.mLblName setText:category.name]; 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidPhotoCollectionCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidPhotoCollectionCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidPhotoCollectionCell.h" 10 | #import "PHColorHelper.h" 11 | #import "UserData.h" 12 | #import "ApiConfig.h" 13 | #import 14 | 15 | @interface BidPhotoCollectionCell() 16 | 17 | @property (weak, nonatomic) IBOutlet UIImageView *mImgView; 18 | 19 | @end 20 | 21 | @implementation BidPhotoCollectionCell 22 | 23 | - (void)awakeFromNib { 24 | [super awakeFromNib]; 25 | 26 | // adding border 27 | [self.contentView.layer setBorderWidth:0.5]; 28 | [self.contentView.layer setBorderColor:[PHColorHelper colorTextGray].CGColor]; 29 | } 30 | 31 | - (void)fillContent:(NSString *)path { 32 | NSString *strUrl = [NSString stringWithFormat:@"%@%@", PH_API_BASE_ITEM_FILE_URL, path]; 33 | [self.mImgView sd_setImageWithURL:[NSURL URLWithString:strUrl]]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Playground/Model/CategoryData.m: -------------------------------------------------------------------------------- 1 | // 2 | // Category.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CategoryData.h" 10 | #import "CommonUtils.h" 11 | 12 | @implementation CategoryData 13 | 14 | + (NSInteger)getCount { 15 | CommonUtils *utils = [CommonUtils sharedObject]; 16 | return [utils.maryCategory count]; 17 | } 18 | 19 | + (CategoryData *)getItem:(NSInteger)index { 20 | CommonUtils *utils = [CommonUtils sharedObject]; 21 | return utils.maryCategory[index]; 22 | } 23 | 24 | 25 | - (id)initWithDictionary:(NSDictionary *)value { 26 | self.id = [[value objectForKey:@"id"] integerValue]; 27 | self.name = [value objectForKey:@"name"]; 28 | 29 | return self; 30 | } 31 | 32 | /** 33 | get image file name of the category 34 | @return <#return value description#> 35 | */ 36 | - (NSString *)getImageName { 37 | NSString *strName = [NSString stringWithFormat:@"ct%02d", (int)self.id]; 38 | return strName; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCTextField/PCTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // PLTextField.m 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCTextField.h" 10 | 11 | @interface PCTextField() { 12 | int mnLeftMargin; 13 | } 14 | @end 15 | 16 | @implementation PCTextField 17 | 18 | - (void) awakeFromNib { 19 | [super awakeFromNib]; 20 | 21 | mnLeftMargin = 10; 22 | } 23 | 24 | /* 25 | // Only override drawRect: if you perform custom drawing. 26 | // An empty implementation adversely affects performance during animation. 27 | - (void)drawRect:(CGRect)rect { 28 | // Drawing code 29 | } 30 | */ 31 | 32 | - (CGRect)textRectForBounds:(CGRect)bounds { 33 | return CGRectInset(bounds, mnLeftMargin, 0); 34 | } 35 | 36 | - (CGRect)placeholderRectForBounds:(CGRect)bounds { 37 | return CGRectInset(bounds, mnLeftMargin, 0); 38 | } 39 | 40 | - (CGRect)editingRectForBounds:(CGRect)bounds { 41 | return CGRectInset(bounds, mnLeftMargin, 0); 42 | } 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /PlaygroundTests/PlaygroundTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PlaygroundTests.m 3 | // PlaygroundTests 4 | // 5 | // Created by Administrator on 17/1/7. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PlaygroundTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PlaygroundTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticePrice/PCNoticePrice.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCNoticePrice.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNoticePrice.h" 10 | #import "PHTextHelper.h" 11 | 12 | @implementation PCNoticePrice 13 | 14 | /* 15 | // Only override drawRect: if you perform custom drawing. 16 | // An empty implementation adversely affects performance during animation. 17 | - (void)drawRect:(CGRect)rect { 18 | // Drawing code 19 | } 20 | */ 21 | 22 | - (void)awakeFromNib { 23 | [super awakeFromNib]; 24 | 25 | // 26 | // font 27 | // 28 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:[PHTextHelper fontNoticeSmall]]]; 29 | [self.mLblValue setFont:[PHTextHelper myriadProBold:[PHTextHelper fontNoticeMedium]]]; 30 | } 31 | 32 | + (id)getView { 33 | return [super getView:@"PCNoticePrice"]; 34 | } 35 | 36 | - (void)layoutSubviews { 37 | [super layoutSubviews]; 38 | 39 | // shadow 40 | [self setShadow:5 opacity:0.5f radius:5]; 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CategoryCell.h" 10 | #import "PHTextHelper.h" 11 | #import "CategoryData.h" 12 | 13 | @interface CategoryCell() 14 | 15 | @property (weak, nonatomic) IBOutlet UIImageView *mImgviewPhoto; 16 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 17 | 18 | @end 19 | 20 | @implementation CategoryCell 21 | 22 | - (void)awakeFromNib { 23 | [super awakeFromNib]; 24 | 25 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:24]]; 26 | } 27 | 28 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 29 | [super setSelected:selected animated:animated]; 30 | 31 | // Configure the view for the selected state 32 | } 33 | 34 | - (void)fillContent:(CategoryData *)category { 35 | // set image 36 | [self.mImgviewPhoto setImage:[UIImage imageNamed:[category getImageName]]]; 37 | 38 | // set name 39 | [self.mLblTitle setText:category.name]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Playground/Model/UserData.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @interface UserData : BaseModelData 12 | 13 | @property (nonatomic, retain) NSString *name; 14 | @property (nonatomic, retain) NSString *username; 15 | @property (nonatomic, retain) NSString *email; 16 | @property (nonatomic, retain) NSString *photo; 17 | @property (nonatomic, retain) NSDate *birthday; 18 | @property (nonatomic) NSInteger gender; 19 | 20 | // other fields 21 | @property (nonatomic, retain) NSMutableArray *auctionItems; 22 | @property (nonatomic, retain) NSMutableArray *bidItems; 23 | @property (nonatomic) NSInteger countGivenUp; 24 | @property (nonatomic) NSInteger rate; 25 | 26 | 27 | + (UserData *)currentUser; 28 | + (void)setCurrentUser:(UserData *)user; 29 | 30 | - (id)initWithDic:(NSDictionary *)data; 31 | - (void)updateProfile:(NSDictionary *)data; 32 | - (void)updateEmail:(NSDictionary *)data; 33 | 34 | - (NSString *)photoUrl; 35 | 36 | - (void)fetchAuctionItems:(NSArray *)aryDic; 37 | - (void)fetchBidItems:(NSArray *)aryDic; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticeTimeout/PCNoticeTimeout.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCNoticeTimeout.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNoticeTimeout.h" 10 | #import "PHTextHelper.h" 11 | 12 | @interface PCNoticeTimeout() 13 | 14 | @end 15 | 16 | 17 | @implementation PCNoticeTimeout 18 | 19 | /* 20 | // Only override drawRect: if you perform custom drawing. 21 | // An empty implementation adversely affects performance during animation. 22 | - (void)drawRect:(CGRect)rect { 23 | // Drawing code 24 | } 25 | */ 26 | 27 | - (void)awakeFromNib { 28 | [super awakeFromNib]; 29 | 30 | // 31 | // font 32 | // 33 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:[PHTextHelper fontNoticeMedium]]]; 34 | [self.mLblValue setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeLarge]]]; 35 | } 36 | 37 | + (id)getView { 38 | return [super getView:@"PCNoticeTimeout"]; 39 | } 40 | 41 | - (void)layoutSubviews { 42 | [super layoutSubviews]; 43 | 44 | // shadow 45 | [self setShadow:10 opacity:0.5f radius:10]; 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Playground/View/BaseViewController/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseViewController : UIViewController 12 | 13 | // navbar 14 | - (void)showSearch:(BOOL)showSearch showBack:(BOOL)showBack; 15 | 16 | - (void)showTitle:(BOOL)show; 17 | - (void)setTitle:(NSString *)value; 18 | 19 | - (void)setSearchDelegate:(UIViewController *)controller; 20 | - (NSString *)getSearchString; 21 | - (void)setSearchString:(NSString *)value; 22 | - (void)showNavbarCongrat:(BOOL)show; 23 | 24 | - (void)setGestureRecognizer; 25 | 26 | // controls 27 | - (void)initLoginButton:(UIButton *)button; 28 | - (void)initRoundButton:(UIButton *)button; 29 | - (void)initTableView:(UITableView *)tableview haveBottombar:(BOOL)haveBottombar; 30 | 31 | // actions 32 | - (void)enableKeyboardNotification; 33 | - (void)dismissKeyboard:(UITapGestureRecognizer *) sender; 34 | 35 | // delegations 36 | - (BOOL)textFieldShouldReturn:(UITextField *)textField; 37 | 38 | - (void)onButBack:(id)sender; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Playground/Helpers/PHUiHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // PHUiHelper.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/14/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | enum { 12 | // iPhone 1-4 (320x480px) 13 | PHDevice_iPhoneStandard = 1, 14 | // iPhone 5 (320x568px) 15 | PHDevice_iPhone5 = 3, 16 | // iPhone 6-7 (375x667px) 17 | PHDevice_iPhone6 = 4, 18 | // iPhone 6-7 Plus (414x736px) 19 | PHDevice_iPhone6Plus = 5, 20 | // Other 21 | PHDevice_Other = 6 22 | }; 23 | 24 | typedef NSUInteger PHDeviceType; 25 | 26 | @interface PHUiHelper : NSObject 27 | 28 | + (PHDeviceType) deviceType; 29 | 30 | // dimensions 31 | + (CGFloat) marginLeftNormal; 32 | 33 | // ui helper 34 | + (void)showAlertView:(UIViewController *)viewController message:(NSString *)message; 35 | + (void)showAlertView:(UIViewController *)viewController title:(NSString *)title message:(NSString *)message; 36 | 37 | + (void)makeRounded:(UIView *)view; 38 | + (void)setPurpleBorder:(UIView *)view cornerRadius:(double)radius; 39 | + (UIImage *)blueBackground; 40 | + (UIImage *)redBackground; 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Playground/Resource/Category.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | category 6 | 7 | 8 | id 9 | 0 10 | name 11 | For Him 12 | 13 | 14 | id 15 | 1 16 | name 17 | For Her 18 | 19 | 20 | id 21 | 2 22 | name 23 | Tech 24 | 25 | 26 | id 27 | 3 28 | name 29 | Entertainment 30 | 31 | 32 | id 33 | 4 34 | name 35 | Beauty 36 | 37 | 38 | id 39 | 5 40 | name 41 | Kids 42 | 43 | 44 | id 45 | 6 46 | name 47 | Others 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Playground/ApiManager/ApiClientCore.h: -------------------------------------------------------------------------------- 1 | // 2 | // ApiClientCore.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/26/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #define MEDIA_NAME_KEY @"name" 10 | #define MEDIA_DATA_KEY @"data" 11 | 12 | #import 13 | 14 | @interface ApiClientCore : NSObject 15 | 16 | + (ApiClientCore *)sharedInstance; 17 | 18 | - (void)sendToServiceByPost:(NSString *)serviceApiUrl 19 | params:(NSDictionary *)params 20 | success:(void (^)(id response))sucess 21 | fail:(void (^)(NSError *error, id response))fail; 22 | 23 | - (void)sendToServiceByPost:(NSString *)serviceApiUrl 24 | params:(NSDictionary *)params 25 | media:(NSArray *)aryMedia 26 | success:(void (^)(id response))sucess 27 | fail:(void (^)(NSError *error, id response))fail; 28 | 29 | - (void)sendToServiceByGet:(NSString *)serviceApiUrl 30 | params:(NSDictionary *)params 31 | success:(void (^)(id response))sucess 32 | fail:(void (^)(NSError *error, id response))fail; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Playground/Model/CommentData.m: -------------------------------------------------------------------------------- 1 | // 2 | // CommentData.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/30/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CommentData.h" 10 | #import "UserData.h" 11 | #import "PHDataHelper.h" 12 | 13 | @implementation CommentData 14 | 15 | - (id)initWithDic:(NSDictionary *)data { 16 | self = [super init]; 17 | 18 | if (self) { 19 | self.id = [[data valueForKey:@"id"] integerValue]; 20 | self.comment = [data valueForKey:@"comment"]; 21 | self.username = [data valueForKey:@"username"]; 22 | 23 | self.createdAt = [PHDataHelper stringToDate:[data valueForKey:@"created_at"] format:@"yyyy-MM-dd HH:mm:ss"]; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (id)initWithText:(NSString *)comment parent:(CommentData *)parent { 30 | 31 | self = [super init]; 32 | 33 | if (self) { 34 | self.comment = comment; 35 | self.username = [UserData currentUser].username; 36 | self.createdAt = [NSDate date]; 37 | 38 | // set parent 39 | if (parent) { 40 | self.parent = parent; 41 | } 42 | } 43 | 44 | return self; 45 | } 46 | 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryExploreCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryExploreCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CategoryExploreCell.h" 10 | #import "PCItemView.h" 11 | #import "PHTextHelper.h" 12 | 13 | @interface CategoryExploreCell() 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblNotice; 16 | 17 | @end 18 | 19 | @implementation CategoryExploreCell 20 | 21 | - (void)awakeFromNib { 22 | [super awakeFromNib]; 23 | 24 | // font 25 | [self.mLblNotice setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 26 | } 27 | 28 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 29 | [super setSelected:selected animated:animated]; 30 | 31 | // Configure the view for the selected state 32 | } 33 | 34 | - (void)setNoticeText:(NSString *)value { 35 | [self.mLblNotice setText:value]; 36 | } 37 | 38 | - (void)fillContent:(NSInteger)count { 39 | if (count > 0) { 40 | [self.mLblNotice setHidden:YES]; 41 | } 42 | else { 43 | [self.mLblNotice setHidden:NO]; 44 | } 45 | 46 | // refresh collection view 47 | [self.mCollectionView reloadData]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidCommentCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidCommentCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidCommentCell.h" 10 | #import "CommentData.h" 11 | #import "PHDataHelper.h" 12 | 13 | @interface BidCommentCell() 14 | 15 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mCstBubbleMargin; 16 | 17 | @end 18 | 19 | @implementation BidCommentCell 20 | 21 | /* 22 | // Only override drawRect: if you perform custom drawing. 23 | // An empty implementation adversely affects performance during animation. 24 | - (void)drawRect:(CGRect)rect { 25 | // Drawing code 26 | } 27 | */ 28 | 29 | - (void)fillContent:(id)data { 30 | CommentData *comment = (CommentData *)data; 31 | 32 | // time 33 | [self.mLblTime setText:[PHDataHelper dateToString:comment.createdAt format:@"yyyy-MM-dd HH:mm:ss"]]; 34 | 35 | // username 36 | [self.mLblUsername setText:comment.username]; 37 | 38 | // comment 39 | [self.mLblBubble setText:comment.comment]; 40 | 41 | // indent 42 | if (comment.parent > 0) { 43 | [self.mCstBubbleMargin setConstant:39]; 44 | } 45 | else { 46 | [self.mCstBubbleMargin setConstant:16]; 47 | } 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Playground/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-40x40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-60x60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@3x.png", 49 | "scale" : "3x" 50 | } 51 | ], 52 | "info" : { 53 | "version" : 1, 54 | "author" : "xcode" 55 | } 56 | } -------------------------------------------------------------------------------- /PlaygroundUITests/PlaygroundUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PlaygroundUITests.m 3 | // PlaygroundUITests 4 | // 5 | // Created by Administrator on 17/1/7. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PlaygroundUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PlaygroundUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Playground/Model/ItemData.h: -------------------------------------------------------------------------------- 1 | // 2 | // ItemData.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/29/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BaseModelData.h" 10 | 11 | @class UserData; 12 | 13 | @interface ItemData : BaseModelData 14 | 15 | @property (nonatomic, retain) NSString *title; 16 | @property (nonatomic, retain) NSString *desc; 17 | @property (nonatomic) NSInteger category; 18 | @property (nonatomic) NSInteger price; 19 | @property (nonatomic) NSInteger condition; 20 | @property (nonatomic) NSInteger status; 21 | 22 | @property (nonatomic) NSInteger rate; 23 | 24 | @property (nonatomic, retain) NSString *coverImage; 25 | @property (nonatomic, retain) NSArray *imagePreview; 26 | @property (nonatomic, retain) NSDate *dateEnd; 27 | @property (nonatomic) NSInteger contact; 28 | 29 | // other fields 30 | @property (nonatomic, retain) UserData *user; 31 | @property (nonatomic) NSInteger minuteRemain; 32 | @property (nonatomic, retain) NSMutableArray *bids; 33 | 34 | - (id)initWithDic:(NSDictionary *)data; 35 | - (NSString *)remainTime; 36 | - (NSString *)remainTimeLong; 37 | - (NSString *)remainAuctionTimeLong:(NSInteger)minAdd; 38 | 39 | - (NSInteger)getRemainMinutes; 40 | - (NSString *)getCoverImageUrl; 41 | 42 | - (NSInteger)getMaxBidUser; 43 | - (NSInteger)getMaxBidPrice; 44 | 45 | - (BOOL)availableToBid; 46 | - (NSInteger)getUserRank:(id)userInfo; 47 | 48 | - (BOOL)isMine; 49 | - (id)getMyBid; 50 | 51 | - (NSString *)username; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ActionSheetPicker-3.0 (2.2.0) 3 | - AFNetworking (3.1.0): 4 | - AFNetworking/NSURLSession (= 3.1.0) 5 | - AFNetworking/Reachability (= 3.1.0) 6 | - AFNetworking/Security (= 3.1.0) 7 | - AFNetworking/Serialization (= 3.1.0) 8 | - AFNetworking/UIKit (= 3.1.0) 9 | - AFNetworking/NSURLSession (3.1.0): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/Reachability (3.1.0) 14 | - AFNetworking/Security (3.1.0) 15 | - AFNetworking/Serialization (3.1.0) 16 | - AFNetworking/UIKit (3.1.0): 17 | - AFNetworking/NSURLSession 18 | - SDWebImage (3.8.2): 19 | - SDWebImage/Core (= 3.8.2) 20 | - SDWebImage/Core (3.8.2) 21 | - SVProgressHUD (2.1.2) 22 | - TPKeyboardAvoiding (1.3.1) 23 | - TTTAttributedLabel (2.0.0) 24 | 25 | DEPENDENCIES: 26 | - ActionSheetPicker-3.0 27 | - AFNetworking (~> 3.0) 28 | - SDWebImage (~> 3.8) 29 | - SVProgressHUD 30 | - TPKeyboardAvoiding 31 | - TTTAttributedLabel 32 | 33 | SPEC CHECKSUMS: 34 | ActionSheetPicker-3.0: d11a4c12c6aaf704b8a3f56d179198c99f3e41e6 35 | AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67 36 | SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c 37 | SVProgressHUD: c404a55d78acbeb7ebb78b76d3faf986475a6994 38 | TPKeyboardAvoiding: 0d6af20e95e2850f4c621841225b59ec7d8dd852 39 | TTTAttributedLabel: 8cffe8e127e4e82ff3af1e5386d4cd0ad000b656 40 | 41 | PODFILE CHECKSUM: 65dd819f5002ff6580344960a190606571247508 42 | 43 | COCOAPODS: 1.2.0 44 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ProfileUserCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProfileUserCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ProfileUserCell.h" 10 | #import "PHUiHelper.h" 11 | #import "PHTextHelper.h" 12 | #import "PHColorHelper.h" 13 | #import 14 | #import "UserData.h" 15 | 16 | @interface ProfileUserCell() 17 | 18 | @property (weak, nonatomic) IBOutlet UIImageView *mImgviewUser; 19 | @property (weak, nonatomic) IBOutlet UILabel *mLblUsername; 20 | 21 | @end 22 | 23 | @implementation ProfileUserCell 24 | 25 | - (void)awakeFromNib { 26 | [super awakeFromNib]; 27 | 28 | // make border 29 | [self.mImgviewUser.layer setBorderWidth:0.5]; 30 | [self.mImgviewUser.layer setBorderColor:[PHColorHelper colorTextGray].CGColor]; 31 | 32 | // set font 33 | [self.mLblUsername setFont:[PHTextHelper myriadProBlack:[PHTextHelper fontSizeSemiLarge]]]; 34 | } 35 | 36 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 37 | [super setSelected:selected animated:animated]; 38 | 39 | // Configure the view for the selected state 40 | } 41 | 42 | - (void)layoutSubviews { 43 | [super layoutSubviews]; 44 | 45 | // init UI 46 | [PHUiHelper makeRounded:self.mImgviewUser]; 47 | } 48 | 49 | - (void)fillContent:(id)data { 50 | // set content 51 | UserData *user = (UserData *)data; 52 | 53 | [self.mImgviewUser sd_setImageWithURL:[NSURL URLWithString:[user photoUrl]]]; 54 | [self.mLblUsername setText:user.name]; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Playground/Helpers/PHDataHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // PHDataHelper.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PHDataHelper.h" 10 | 11 | @implementation PHDataHelper 12 | 13 | 14 | /** 15 | string to date 16 | 17 | @param value <#value description#> 18 | @param format <#format description#> 19 | @return date 20 | */ 21 | + (NSDate *)stringToDate:(NSString *)value format:(NSString *)format { 22 | 23 | if ([PHDataHelper isObjectNull:value]) { 24 | return nil; 25 | } 26 | 27 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 28 | NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; 29 | 30 | [formatter setTimeZone:timeZone]; 31 | [formatter setDateFormat:format]; 32 | 33 | return [formatter dateFromString:value]; 34 | } 35 | 36 | /** 37 | date to string 38 | 39 | @param value <#value description#> 40 | @param format <#format description#> 41 | @return <#return value description#> 42 | */ 43 | + (NSString *)dateToString:(NSDate *)value format:(NSString *)format { 44 | if (!value) { 45 | return nil; 46 | } 47 | 48 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 49 | NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; 50 | 51 | [formatter setTimeZone:timeZone]; 52 | [formatter setDateFormat:format]; 53 | 54 | return [formatter stringFromDate:value]; 55 | } 56 | 57 | + (BOOL)isObjectNull:(NSObject *)object { 58 | return !object || [object isKindOfClass:[NSNull class]]; 59 | } 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Playground/View/LandingViewController/LandingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LandingViewController.m 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "LandingViewController.h" 10 | #import "PHTextHelper.h" 11 | 12 | @interface LandingViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UIButton *mButFacebook; 15 | @property (weak, nonatomic) IBOutlet UIButton *mButSignup; 16 | @property (weak, nonatomic) IBOutlet UIButton *mButLogin; 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *mLblOr; 19 | 20 | @end 21 | 22 | @implementation LandingViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | 27 | // 28 | // init appearance of the controls 29 | // 30 | UIFont *fontRegular = [PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]; 31 | 32 | // signin button 33 | [self initLoginButton:self.mButSignup]; 34 | 35 | // facebook button 36 | [self initLoginButton:self.mButFacebook]; 37 | 38 | // or label 39 | [self.mLblOr setFont:fontRegular]; 40 | 41 | // other buttons 42 | [self.mButLogin.titleLabel setFont:fontRegular]; 43 | } 44 | 45 | - (void)didReceiveMemoryWarning { 46 | [super didReceiveMemoryWarning]; 47 | // Dispose of any resources that can be recreated. 48 | } 49 | 50 | /* 51 | #pragma mark - Navigation 52 | 53 | // In a storyboard-based application, you will often want to do a little preparation before navigation 54 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 55 | // Get the new view controller using [segue destinationViewController]. 56 | // Pass the selected object to the new view controller. 57 | } 58 | */ 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Auction iOS App 2 | ====== 3 | 4 | > Auction and bidding for redundant goods, having its own [backend](https://github.com/highjump0615/Auction_Backend_Laravel). 5 | 6 | ## Overview 7 | 8 | ### 1. Main Features 9 | - User management 10 | Signup, Login, Profile, Setting, ... 11 | - Item Management 12 | Upload, Search, Category, Contact, Inbox, ... 13 | - Bid Management 14 | Place bid, Get max bid, Give up, Delete, ... 15 | 16 | ### 2. Techniques 17 | #### 2.1 UI Implementation 18 | - Implemented responsive UI design with Autolayout 19 | - Used Autoresize for some customized controls 20 | - Implemented length limit of ``Textfield`` and ``TextView`` 21 | ``textFieldDidBeginEditing()``, ``textFieldShouldEndEditing()`` functions are used mainly. 22 | - Made tabbar item working as button 23 | Implemented using shouldSelectViewController of ``UITabBarControllerDelegate``. 24 | - Saved data in plist file 25 | Created in Resource manually, implemented read/write programatically. 26 | 27 | #### 2.2 Third Party Libraries used 28 | - [TPKeyboardAvoiding](https://github.com/michaeltyson/TPKeyboardAvoiding) 29 | Automatically make view avoiding keyboard 30 | - [ActionSheetPicker](https://github.com/skywinder/ActionSheetPicker-3.0) 31 | ActionSheetDatePicker and ActionSheetStringPicker are used. 32 | - [TTTAttributedLabel](https://github.com/TTTAttributedLabel/TTTAttributedLabel) 33 | Make UILabel working as button 34 | - [SVProgressHUD](https://github.com/SVProgressHUD/SVProgressHUD) 35 | Progress bar used in calling web service 36 | - [AFNetworking](https://github.com/AFNetworking/AFNetworking) 37 | HTTP processing in iOS 38 | 39 | ## Need to Improve 40 | - Add logic for push notification 41 | - Integrate social login & sharing 42 | - Integrate chat feature 43 | ... ... -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCBorderView/PCBorderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCBorderView.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCBorderView.h" 10 | #import "PHColorHelper.h" 11 | 12 | @interface PCBorderView() { 13 | CALayer *mborderTop; 14 | CALayer *mborderBottom; 15 | 16 | double mdBorderWidth; 17 | } 18 | 19 | @end 20 | 21 | @implementation PCBorderView 22 | 23 | /* 24 | // Only override drawRect: if you perform custom drawing. 25 | // An empty implementation adversely affects performance during animation. 26 | - (void)drawRect:(CGRect)rect { 27 | // Drawing code 28 | } 29 | */ 30 | 31 | - (void)awakeFromNib { 32 | [super awakeFromNib]; 33 | 34 | // init param 35 | mdBorderWidth = 0.5; 36 | } 37 | 38 | /** 39 | remove bottom border 40 | */ 41 | - (void)removeBottom { 42 | [mborderBottom removeFromSuperlayer]; 43 | } 44 | 45 | - (void)layoutSubviews 46 | { 47 | [super layoutSubviews]; 48 | 49 | // 50 | // add top border 51 | // 52 | mborderTop = [CALayer layer]; 53 | mborderTop.backgroundColor = [PHColorHelper colorTextGray].CGColor; 54 | mborderTop.frame = CGRectMake(0, 0, self.frame.size.width, mdBorderWidth); 55 | [self.layer addSublayer:mborderTop]; 56 | 57 | // remove bottomborder if exist 58 | if (mborderBottom) { 59 | [mborderBottom removeFromSuperlayer]; 60 | } 61 | 62 | // 63 | // add bottom border 64 | // 65 | mborderBottom = [CALayer layer]; 66 | mborderBottom.backgroundColor = [PHColorHelper colorTextGray].CGColor; 67 | mborderBottom.frame = CGRectMake(0, self.frame.size.height - mdBorderWidth, self.frame.size.width, mdBorderWidth); 68 | [self.layer addSublayer:mborderBottom]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Created by https://www.gitignore.io/api/objective-c 4 | 5 | ### Objective-C ### 6 | # Xcode 7 | # 8 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 9 | 10 | ## Build generated 11 | build/ 12 | DerivedData/ 13 | 14 | ## Various settings 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata/ 24 | 25 | ## Other 26 | *.moved-aside 27 | *.xcuserstate 28 | 29 | ## Obj-C/Swift specific 30 | *.hmap 31 | *.ipa 32 | *.dSYM.zip 33 | *.dSYM 34 | 35 | # CocoaPods 36 | # 37 | # We recommend against adding the Pods directory to your .gitignore. However 38 | # you should judge for yourself, the pros and cons are mentioned at: 39 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 40 | # 41 | Pods/ 42 | 43 | # Carthage 44 | # 45 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 46 | # Carthage/Checkouts 47 | 48 | Carthage/Build 49 | 50 | # fastlane 51 | # 52 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 53 | # screenshots whenever they are needed. 54 | # For more information about the recommended setup visit: 55 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 56 | 57 | fastlane/report.xml 58 | fastlane/Preview.html 59 | fastlane/screenshots 60 | fastlane/test_output 61 | 62 | # Code Injection 63 | # 64 | # After new code Injection tools there's a generated folder /iOSInjectionProject 65 | # https://github.com/johnno1962/injectionforxcode 66 | 67 | iOSInjectionProject/ 68 | 69 | ### Objective-C Patch ### 70 | *.xcscmblueprint 71 | 72 | # End of https://www.gitignore.io/api/objective-c 73 | -------------------------------------------------------------------------------- /Playground/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 2.3 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | NSCameraUsageDescription 29 | Camera is used for taking portrait of the profile or goods. 30 | NSPhotoLibraryUsageDescription 31 | Photo Library is used for taking portrait of the profile or goods 32 | UIAppFonts 33 | 34 | MyriadPro-Regular.otf 35 | MyriadPro-Bold.otf 36 | MyriadPro-Semibold.otf 37 | MyriadPro-Black.otf 38 | MyriadPro-Light.otf 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIMainStoryboardFile 43 | Main 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | 52 | ITSAppUsesNonExemptEncryption 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/InboxViewController/InboxCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // InboxCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "InboxCell.h" 10 | #import "PHTextHelper.h" 11 | #import "PHColorHelper.h" 12 | #import "PHUiHelper.h" 13 | #import "UserData.h" 14 | #import "ItemData.h" 15 | 16 | @interface InboxCell() 17 | 18 | @end 19 | 20 | @implementation InboxCell 21 | 22 | - (void)awakeFromNib { 23 | [super awakeFromNib]; 24 | 25 | // init rate button 26 | [self.mButRate.titleLabel setFont:[PHTextHelper myriadProRegular:12]]; 27 | [self.mButRate.layer setBorderWidth:1]; 28 | [self.mButRate.layer setBorderColor:[PHColorHelper colorTextBlack].CGColor]; 29 | } 30 | 31 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 32 | [super setSelected:selected animated:animated]; 33 | 34 | // Configure the view for the selected state 35 | } 36 | 37 | - (void)layoutSubviews { 38 | [super layoutSubviews]; 39 | 40 | // price label 41 | [PHUiHelper makeRounded:self.mButRate]; 42 | } 43 | 44 | 45 | - (void)fillContent:(id)data { 46 | [super fillContent:data]; 47 | 48 | UserData *user = [UserData currentUser]; 49 | ItemData *item = (ItemData *)data; 50 | 51 | if ([item.username isEqualToString:user.username]) { 52 | [self.mButRate setEnabled:NO]; 53 | 54 | [self.mButRate.layer setBorderColor:[PHColorHelper colorTextGray].CGColor]; 55 | [self.mButRate setTitleColor:[PHColorHelper colorTextGray] forState:UIControlStateNormal]; 56 | } 57 | else { 58 | [self.mButRate setEnabled:YES]; 59 | 60 | [self.mButRate.layer setBorderColor:[PHColorHelper colorTextBlack].CGColor]; 61 | [self.mButRate setTitleColor:[PHColorHelper colorTextBlack] forState:UIControlStateNormal]; 62 | } 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/EditNotificationViewController/EditNotificationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // EditNotificationViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/19/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "EditNotificationViewController.h" 10 | #import "PHTextHelper.h" 11 | 12 | @interface EditNotificationViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblWon; 16 | @property (weak, nonatomic) IBOutlet UILabel *mLblLost; 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblLastHour; 18 | @property (weak, nonatomic) IBOutlet UILabel *mLblReceive; 19 | @property (weak, nonatomic) IBOutlet UILabel *mLblTransfer; 20 | 21 | @end 22 | 23 | @implementation EditNotificationViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | // font 29 | double dFontSize = 14; 30 | 31 | [self.mLblTitle setFont:[PHTextHelper myriadProRegular:dFontSize]]; 32 | [self.mLblWon setFont:[PHTextHelper myriadProRegular:dFontSize]]; 33 | [self.mLblLost setFont:[PHTextHelper myriadProRegular:dFontSize]]; 34 | [self.mLblLastHour setFont:[PHTextHelper myriadProRegular:dFontSize]]; 35 | [self.mLblReceive setFont:[PHTextHelper myriadProRegular:dFontSize]]; 36 | [self.mLblTransfer setFont:[PHTextHelper myriadProRegular:dFontSize]]; 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | /* 45 | #pragma mark - Navigation 46 | 47 | // In a storyboard-based application, you will often want to do a little preparation before navigation 48 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 49 | // Get the new view controller using [segue destinationViewController]. 50 | // Pass the selected object to the new view controller. 51 | } 52 | */ 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNotice.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCNotice.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNotice.h" 10 | #import "PHColorHelper.h" 11 | 12 | @interface PCNotice() 13 | 14 | @end 15 | 16 | @implementation PCNotice 17 | 18 | /* 19 | // Only override drawRect: if you perform custom drawing. 20 | // An empty implementation adversely affects performance during animation. 21 | - (void)drawRect:(CGRect)rect { 22 | // Drawing code 23 | } 24 | */ 25 | 26 | - (void)awakeFromNib { 27 | [super awakeFromNib]; 28 | 29 | mdRadius = 8; 30 | 31 | // 32 | // corner round 33 | // 34 | [self.mViewTimeBg.layer setMasksToBounds:YES]; 35 | [self.mViewTimeBg.layer setCornerRadius:mdRadius]; 36 | } 37 | 38 | /** 39 | add shadow to the view 40 | @param offset <#offset description#> 41 | @param opacity <#opacity description#> 42 | @param radius <#radius description#> 43 | */ 44 | - (void)setShadow:(CGFloat)offset opacity:(CGFloat)opacity radius:(CGFloat)radius { 45 | UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.bounds]; 46 | self.layer.shadowColor = [PHColorHelper colorShadow].CGColor; 47 | self.layer.shadowOffset = CGSizeMake(0, offset); 48 | self.layer.shadowOpacity = opacity; 49 | self.layer.shadowRadius = radius; 50 | self.layer.shadowPath = shadowPath.CGPath; 51 | } 52 | 53 | /** 54 | set title text 55 | @param value string to set 56 | */ 57 | - (void)setTitle:(NSString *)value { 58 | [self.mLblTitle setText:value]; 59 | } 60 | 61 | /** 62 | set title text 63 | @param value string to set 64 | */ 65 | - (void)setValueText:(NSString *)value { 66 | [self.mLblValue setText:value]; 67 | } 68 | 69 | 70 | /** 71 | set background image 72 | @param image <#image description#> 73 | */ 74 | - (void)setBackgroundImage:(UIImage *)image { 75 | [self.mViewTimeBg setImage:image]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryDetailViewController/CategoryDetailCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CategoryDetailCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/14/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "CategoryDetailCell.h" 10 | #import "PCItemView.h" 11 | #import "PHTextHelper.h" 12 | #import "PHColorHelper.h" 13 | #import "PHUiHelper.h" 14 | #import "ItemData.h" 15 | 16 | @interface CategoryDetailCell() 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *mLblPrice; 19 | 20 | @end 21 | 22 | @implementation CategoryDetailCell 23 | 24 | - (void)awakeFromNib { 25 | [super awakeFromNib]; 26 | 27 | // init price cell 28 | [self.mLblPrice setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeMedium]]]; 29 | [self.mLblPrice.layer setBorderWidth:1]; 30 | [self.mLblPrice.layer setBorderColor:[PHColorHelper colorTextBlack].CGColor]; 31 | } 32 | 33 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 34 | [super setSelected:selected animated:animated]; 35 | 36 | // Configure the view for the selected state 37 | } 38 | 39 | - (void)layoutSubviews { 40 | [super layoutSubviews]; 41 | 42 | // Make sure the contentView does a layout pass here so that its subviews have their frames set, which we 43 | // need to use to set the preferredMaxLayoutWidth below. 44 | [self.contentView setNeedsLayout]; 45 | [self.contentView layoutIfNeeded]; 46 | 47 | // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame, 48 | // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height. 49 | self.mLblPrice.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblPrice.frame); 50 | 51 | // price label 52 | [PHUiHelper makeRounded:self.mLblPrice]; 53 | } 54 | 55 | - (void)fillContent:(id)data { 56 | [super fillContent:data]; 57 | 58 | // set price 59 | ItemData *item = (ItemData *)data; 60 | [self.mLblPrice setText:[NSString stringWithFormat:@"$%ld", (long)item.price]]; 61 | } 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Playground/ApiManager/ApiConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // ApiConfig.h 3 | // Playground 4 | // 5 | // Created by Top1 on 1/26/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #ifndef ApiConfig_h 10 | #define ApiConfig_h 11 | 12 | #define PH_FAIL_STATE 400 13 | 14 | #define PH_API_BASE_URL @"http://tnb.vij.mybluehost.me/playground/public/api/v1/" 15 | #define PH_API_BASE_ITEM_FILE_URL @"http://tnb.vij.mybluehost.me/playground/public/uploads/item/" 16 | #define PH_API_BASE_USER_FILE_URL @"http://tnb.vij.mybluehost.me/playground/public/uploads/user/" 17 | //#define PH_API_BASE_URL @"http://localhost/playground/public/api/v1/" 18 | //#define PH_API_BASE_ITEM_FILE_URL @"http://localhost/playground/public/uploads/item/" 19 | //#define PH_API_BASE_USER_FILE_URL @"http://localhost/playground/public/uploads/user/" 20 | 21 | 22 | // user api 23 | #define PH_API_LOGIN @"login" 24 | #define PH_API_SIGNUP @"signup" 25 | #define PH_API_GETUSER @"user" 26 | #define PH_API_GETUSERINFO @"userinfo" 27 | #define PH_API_SAVEPROFILE @"saveprofile" 28 | #define PH_API_SAVESETTING @"savesetting" 29 | 30 | // item api 31 | #define PH_API_UPLOAD_ITEM @"uploaditem" 32 | #define PH_API_EXPLORE @"explore" 33 | #define PH_API_GETCATEGORY @"category" 34 | #define PH_API_SEARCH_ITEM @"search" 35 | #define PH_API_CONTACT_ITEM @"contact" 36 | 37 | // bid api 38 | #define PH_API_BID_ITEM @"bid" 39 | #define PH_API_GETMAXBID @"maxbid" 40 | #define PH_API_GIVEUPBID @"giveup" 41 | #define PH_API_DELETEBID @"delete" 42 | 43 | // comment api 44 | #define PH_API_GETCOMMENT @"comment" 45 | #define PH_API_ADDCOMMENT @"addcomment" 46 | 47 | // inbox api 48 | #define PH_API_GETINBOX @"inbox" 49 | #define PH_API_DELETEINBOX @"deleteinbox" 50 | 51 | // rate api 52 | #define PH_API_RATE @"rate" 53 | 54 | #endif /* ApiConfig_h */ 55 | -------------------------------------------------------------------------------- /Playground/View/CategoryViewController/CategoryDetailViewController/ItemBaseCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ItemBaseCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ItemBaseCell.h" 10 | #import "PCItemView.h" 11 | #import "PHTextHelper.h" 12 | #import "ItemData.h" 13 | 14 | @interface ItemBaseCell() { 15 | PCItemView *mItemView; 16 | } 17 | 18 | @property (weak, nonatomic) IBOutlet UIView *mViewPhoto; 19 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 20 | @property (weak, nonatomic) IBOutlet UILabel *mLblUsername; 21 | 22 | @end 23 | 24 | @implementation ItemBaseCell 25 | 26 | - (void)awakeFromNib { 27 | [super awakeFromNib]; 28 | 29 | // add item view 30 | mItemView = [PCItemView getView]; 31 | mItemView.frame = self.mViewPhoto.bounds; 32 | 33 | [self.mViewPhoto addSubview:mItemView]; 34 | 35 | // init labels 36 | [self.mLblTitle setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 37 | [self.mLblUsername setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeSmall]]]; 38 | } 39 | 40 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 41 | [super setSelected:selected animated:animated]; 42 | 43 | // Configure the view for the selected state 44 | } 45 | 46 | - (void)fillContent:(id)data { 47 | ItemData *item = (ItemData *)data; 48 | 49 | [mItemView setItemData:item]; 50 | [self.mLblTitle setText:item.title]; 51 | [self.mLblUsername setText:item.username]; 52 | } 53 | 54 | - (void)layoutSubviews { 55 | [super layoutSubviews]; 56 | 57 | // Make sure the contentView does a layout pass here so that its subviews have their frames set, which we 58 | // need to use to set the preferredMaxLayoutWidth below. 59 | [self.contentView setNeedsLayout]; 60 | [self.contentView layoutIfNeeded]; 61 | 62 | // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame, 63 | // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height. 64 | self.mLblTitle.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblTitle.frame); 65 | self.mLblUsername.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblUsername.frame); 66 | } 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ProfileStatisticsCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProfileStatisticsCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ProfileStatisticsCell.h" 10 | #import "PHTextHelper.h" 11 | #import "UserData.h" 12 | 13 | @interface ProfileStatisticsCell() 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblAuction; 16 | @property (weak, nonatomic) IBOutlet UILabel *mLblAuctionCount; 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblBid; 18 | @property (weak, nonatomic) IBOutlet UILabel *mLblBidCount; 19 | @property (weak, nonatomic) IBOutlet UILabel *mLblGiveup; 20 | @property (weak, nonatomic) IBOutlet UILabel *mLblGiveupCount; 21 | @property (weak, nonatomic) IBOutlet UILabel *mLblRating; 22 | @property (weak, nonatomic) IBOutlet UILabel *mLblRatingValue; 23 | 24 | @end 25 | 26 | @implementation ProfileStatisticsCell 27 | 28 | - (void)awakeFromNib { 29 | [super awakeFromNib]; 30 | 31 | // init font 32 | double dFontSize = [PHTextHelper fontSizeNormal]; 33 | 34 | [self.mLblAuction setFont:[PHTextHelper myriadProRegular:dFontSize]]; 35 | [self.mLblAuctionCount setFont:[PHTextHelper myriadProRegular:dFontSize]]; 36 | [self.mLblBid setFont:[PHTextHelper myriadProRegular:dFontSize]]; 37 | [self.mLblBidCount setFont:[PHTextHelper myriadProRegular:dFontSize]]; 38 | [self.mLblGiveup setFont:[PHTextHelper myriadProRegular:dFontSize]]; 39 | [self.mLblGiveupCount setFont:[PHTextHelper myriadProRegular:dFontSize]]; 40 | [self.mLblRating setFont:[PHTextHelper myriadProRegular:dFontSize]]; 41 | [self.mLblRatingValue setFont:[PHTextHelper myriadProRegular:dFontSize]]; 42 | } 43 | 44 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 45 | [super setSelected:selected animated:animated]; 46 | 47 | // Configure the view for the selected state 48 | } 49 | 50 | - (void)fillContent:(id)data { 51 | UserData *user = (UserData *)data; 52 | 53 | // aunction count 54 | [self.mLblAuctionCount setText:[NSString stringWithFormat:@"%ld", (long)user.auctionItems.count]]; 55 | 56 | // bid count 57 | [self.mLblBidCount setText:[NSString stringWithFormat:@"%ld", (long)user.bidItems.count]]; 58 | 59 | // given up count 60 | [self.mLblGiveupCount setText:[NSString stringWithFormat:@"%ld", (long)user.countGivenUp]]; 61 | 62 | // rate 63 | [self.mLblRatingValue setText:[NSString stringWithFormat:@"%ld%%", (long)user.rate]]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCRateView/PCRateView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCRateView.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCRateView.h" 10 | 11 | @interface PCRateView() { 12 | NSMutableArray *maryButStar; 13 | int mnStar; 14 | } 15 | 16 | @property (weak, nonatomic) IBOutlet UIButton *mButStar1; 17 | @property (weak, nonatomic) IBOutlet UIButton *mButStar2; 18 | @property (weak, nonatomic) IBOutlet UIButton *mButStar3; 19 | @property (weak, nonatomic) IBOutlet UIButton *mButStar4; 20 | @property (weak, nonatomic) IBOutlet UIButton *mButStar5; 21 | 22 | @end 23 | 24 | @implementation PCRateView 25 | 26 | /* 27 | // Only override drawRect: if you perform custom drawing. 28 | // An empty implementation adversely affects performance during animation. 29 | - (void)drawRect:(CGRect)rect { 30 | // Drawing code 31 | } 32 | */ 33 | 34 | - (void)awakeFromNib { 35 | [super awakeFromNib]; 36 | 37 | // init star buttons 38 | maryButStar = [[NSMutableArray alloc] init]; 39 | 40 | [maryButStar addObject:self.mButStar1]; 41 | [maryButStar addObject:self.mButStar2]; 42 | [maryButStar addObject:self.mButStar3]; 43 | [maryButStar addObject:self.mButStar4]; 44 | [maryButStar addObject:self.mButStar5]; 45 | 46 | for (UIButton *button in maryButStar) { 47 | [button addTarget:self action:@selector(onButStar:) forControlEvents:UIControlEventTouchUpInside]; 48 | } 49 | } 50 | 51 | + (id)getView { 52 | return [super getView:@"PCRateView"]; 53 | } 54 | 55 | /** 56 | get rate value 57 | @return 0~100 58 | */ 59 | - (NSInteger)getRate { 60 | return (mnStar + 1) * 20; 61 | } 62 | 63 | /** 64 | init stars according to the rate 65 | @param rate 0~100 66 | */ 67 | - (void)setRate:(NSInteger)rate { 68 | mnStar = round(rate / 20.0) - 1; 69 | [self onButStar:nil]; 70 | } 71 | 72 | - (void)onButStar:(id)sender { 73 | 74 | if (sender) { 75 | // this is setting star manually 76 | NSInteger nTag = ((UIButton *)sender).tag; 77 | mnStar = (int)nTag; 78 | } 79 | 80 | // remove all star 81 | for (UIButton *button in maryButStar) { 82 | [button setImage:[UIImage imageNamed:@"rate_star_disable"] forState:UIControlStateNormal]; 83 | } 84 | 85 | // set star 86 | for (int i = 0; i <= mnStar; i++) { 87 | UIButton *button = maryButStar[i]; 88 | [button setImage:[UIImage imageNamed:@"rate_star"] forState:UIControlStateNormal]; 89 | } 90 | } 91 | 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNavbarView/PCNavbarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSNavBarView.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCNavbarView.h" 10 | #import "PHTextHelper.h" 11 | #import "PHUiHelper.h" 12 | 13 | @interface PCNavbarView() 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 16 | @property (weak, nonatomic) IBOutlet UIImageView *mImgviewCongrat; 17 | 18 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mCstSapcing; 19 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mCstBackWidth; 20 | 21 | @end 22 | 23 | @implementation PCNavbarView 24 | 25 | - (void)awakeFromNib { 26 | [super awakeFromNib]; 27 | 28 | // initialize search textfield 29 | [self.mTxtSearch.layer setMasksToBounds:YES]; 30 | [self.mTxtSearch.layer setCornerRadius:5]; 31 | 32 | [PHTextHelper initTextRegular:self.mTxtSearch]; 33 | 34 | // init title label 35 | [self.mLblTitle setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormalLarge]]]; 36 | } 37 | 38 | /* 39 | // Only override drawRect: if you perform custom drawing. 40 | // An empty implementation adversely affects performance during animation. 41 | - (void)drawRect:(CGRect)rect { 42 | // Drawing code 43 | } 44 | */ 45 | 46 | + (id)getView { 47 | return [super getView:@"PCNavbarView"]; 48 | } 49 | 50 | 51 | /** 52 | show/hide search text field 53 | @param showSearch <#showSearch description#> 54 | @param showBack show/hide back button 55 | */ 56 | - (void)showSearch:(BOOL)showSearch showBack:(BOOL)showBack { 57 | 58 | [self.mTxtSearch setHidden:!showSearch]; 59 | 60 | if (showBack) { 61 | // show back button 62 | [self.mCstSapcing setConstant:0]; 63 | [self.mCstBackWidth setConstant:44]; 64 | [self.mButBack setHidden:NO]; 65 | } 66 | else { 67 | // hide back button 68 | [self.mCstSapcing setConstant:[PHUiHelper marginLeftNormal]]; 69 | [self.mCstBackWidth setConstant:0]; 70 | [self.mButBack setHidden:YES]; 71 | } 72 | } 73 | 74 | /** 75 | show/hide title label 76 | @param show <#show description#> 77 | */ 78 | - (void)showTitle:(BOOL)show { 79 | [self.mLblTitle setHidden:!show]; 80 | } 81 | 82 | /** 83 | show/hide congratulations title 84 | @param show <#show description#> 85 | */ 86 | - (void)showCongrat:(BOOL)show { 87 | [self.mImgviewCongrat setHidden:!show]; 88 | } 89 | 90 | - (void)setTitle:(NSString *)value bold:(BOOL)bold { 91 | [self.mLblTitle setText:value]; 92 | 93 | if (bold) { 94 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeNormalLarge]]]; 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ChatViewController/ChatCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ChatCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ChatCell.h" 10 | #import "PHTextHelper.h" 11 | #import "PHUiHelper.h" 12 | 13 | @interface ChatCell() { 14 | double mdHeightTime; 15 | double mdHeightUsername; 16 | } 17 | 18 | @property (weak, nonatomic) IBOutlet UIView *mViewBubble; 19 | 20 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mCstTimeHeight; 21 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mCstHeightUsername; 22 | 23 | @end 24 | 25 | @implementation ChatCell 26 | 27 | - (void)awakeFromNib { 28 | [super awakeFromNib]; 29 | 30 | // font 31 | [self.mLblTime setFont:[PHTextHelper myriadProRegular:10]]; 32 | [self.mLblUsername setFont:[PHTextHelper myriadProRegular:12]]; 33 | [self.mLblBubble setFont:[PHTextHelper myriadProRegular:12]]; 34 | 35 | // bubble view 36 | [PHUiHelper setPurpleBorder:self.mViewBubble cornerRadius:15.0]; 37 | 38 | // init param 39 | mdHeightTime = 20; 40 | mdHeightUsername = 20; 41 | } 42 | 43 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 44 | [super setSelected:selected animated:animated]; 45 | 46 | // Configure the view for the selected state 47 | } 48 | 49 | 50 | /** 51 | show/hide time label 52 | @param show <#show description#> 53 | */ 54 | - (void)showTime:(BOOL)show { 55 | if (show) { 56 | [self.mLblTime setHighlighted:NO]; 57 | [self.mCstTimeHeight setConstant:mdHeightTime]; 58 | } 59 | else { 60 | [self.mLblTime setHighlighted:YES]; 61 | [self.mCstTimeHeight setConstant:0]; 62 | } 63 | } 64 | 65 | /** 66 | show/hide username label 67 | @param show <#show description#> 68 | */ 69 | - (void)showUsername:(BOOL)show { 70 | if (show) { 71 | [self.mLblUsername setHighlighted:NO]; 72 | [self.mCstHeightUsername setConstant:mdHeightUsername]; 73 | } 74 | else { 75 | [self.mLblUsername setHighlighted:YES]; 76 | [self.mCstHeightUsername setConstant:0]; 77 | } 78 | } 79 | 80 | - (void)layoutSubviews 81 | { 82 | [super layoutSubviews]; 83 | 84 | // Make sure the contentView does a layout pass here so that its subviews have their frames set, which we 85 | // need to use to set the preferredMaxLayoutWidth below. 86 | [self.contentView setNeedsLayout]; 87 | [self.contentView layoutIfNeeded]; 88 | 89 | // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame, 90 | // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height. 91 | self.mLblBubble.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblBubble.frame); 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /Playground/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Playground 4 | // 5 | // Created by Administrator on 17/1/7. 6 | // Copyright © 2017年 fred. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "CategoryData.h" 11 | #import "CommonUtils.h" 12 | #import "ApiManager.h" 13 | #import "UserData.h" 14 | #import "MainTabbarController.h" 15 | 16 | @interface AppDelegate () 17 | 18 | @end 19 | 20 | @implementation AppDelegate 21 | 22 | - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | 24 | return YES; 25 | } 26 | 27 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 28 | 29 | // load category data 30 | NSString *strPath = [[NSBundle mainBundle] pathForResource:@"Category" ofType:@"plist"]; 31 | NSMutableDictionary *userDic = [[NSMutableDictionary alloc] initWithContentsOfFile:strPath]; 32 | 33 | CommonUtils *utils = [CommonUtils sharedObject]; 34 | 35 | NSArray *aryCategory = [userDic objectForKey:@"category"]; 36 | for (NSDictionary *dict in aryCategory) { 37 | CategoryData *category = [[CategoryData alloc] initWithDictionary:dict]; 38 | [utils.maryCategory addObject:category]; 39 | } 40 | 41 | return YES; 42 | } 43 | 44 | 45 | - (void)applicationWillResignActive:(UIApplication *)application { 46 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 47 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 48 | } 49 | 50 | 51 | - (void)applicationDidEnterBackground:(UIApplication *)application { 52 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 53 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 54 | } 55 | 56 | 57 | - (void)applicationWillEnterForeground:(UIApplication *)application { 58 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 59 | } 60 | 61 | 62 | - (void)applicationDidBecomeActive:(UIApplication *)application { 63 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 64 | } 65 | 66 | 67 | - (void)applicationWillTerminate:(UIApplication *)application { 68 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Playground/View/UploadViewController/UploadCategoryViewController/UploadCategoryViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UploadCategoryViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "UploadCategoryViewController.h" 10 | #import "UploadInputViewController.h" 11 | #import "PHTextHelper.h" 12 | #import "UploadCategoryCell.h" 13 | #import "CategoryData.h" 14 | 15 | @interface UploadCategoryViewController () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 18 | @property (weak, nonatomic) IBOutlet UITableView *mTableView; 19 | 20 | @end 21 | 22 | @implementation UploadCategoryViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | 27 | // title 28 | [self.mLblTitle setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 29 | 30 | // remove separator of the empty cell 31 | [self.mTableView setTableHeaderView:[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.mTableView.bounds.size.width, 0.01f)]]; 32 | [self.mTableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.mTableView.bounds.size.width, 0.01f)]]; 33 | } 34 | 35 | - (void)didReceiveMemoryWarning { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | /* 41 | #pragma mark - Navigation 42 | 43 | // In a storyboard-based application, you will often want to do a little preparation before navigation 44 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 45 | // Get the new view controller using [segue destinationViewController]. 46 | // Pass the selected object to the new view controller. 47 | } 48 | */ 49 | 50 | 51 | #pragma mark - UITableViewDataSource 52 | 53 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 54 | return [CategoryData getCount]; 55 | } 56 | 57 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 58 | 59 | // get category 60 | CategoryData *ct = [CategoryData getItem:indexPath.row]; 61 | 62 | // fill data 63 | UploadCategoryCell *cellCategory = (UploadCategoryCell *)[tableView dequeueReusableCellWithIdentifier:@"UploadCategoryCell"]; 64 | [cellCategory fillContent:ct]; 65 | 66 | return cellCategory; 67 | } 68 | 69 | #pragma mark - UITableViewDelegate 70 | 71 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 72 | return 40; 73 | } 74 | 75 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 76 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 77 | 78 | // send category to back page 79 | UploadInputViewController *viewController = (UploadInputViewController *)self.delegate; 80 | viewController.mCategory = [CategoryData getItem:indexPath.row]; 81 | 82 | // back to prev page 83 | [self.navigationController popViewControllerAnimated:YES]; 84 | } 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Playground/View/MainTabbarController/MainTabbarController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainTabbarController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/13/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "MainTabbarController.h" 10 | 11 | @interface MainTabbarController () 12 | 13 | @end 14 | 15 | @implementation MainTabbarController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | // set image with original rendering mode 21 | UITabBarItem *item = [self.tabBar.items objectAtIndex:0]; 22 | item.image = [[UIImage imageNamed:@"tab_category"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 23 | 24 | [self updateUploadTabbarItem]; 25 | 26 | item = [self.tabBar.items objectAtIndex:2]; 27 | item.image = [[UIImage imageNamed:@"tab_profile"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 28 | 29 | [self setDelegate:self]; 30 | } 31 | 32 | - (void)viewDidAppear:(BOOL)animated { 33 | [super viewDidAppear:animated]; 34 | 35 | NSMutableArray *aryViewControllers = [[NSMutableArray alloc] initWithArray:self.viewControllers]; 36 | 37 | // if upload tab doesn't exist, add it 38 | if (aryViewControllers.count < 3) { 39 | // restore tabbar items 40 | UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; 41 | UIViewController *vcUpload = [storyBoard instantiateViewControllerWithIdentifier:@"Upload"]; 42 | [aryViewControllers insertObject:vcUpload atIndex:1]; 43 | 44 | [self setViewControllers:aryViewControllers]; 45 | 46 | // update icon again 47 | [self updateUploadTabbarItem]; 48 | } 49 | } 50 | 51 | /** 52 | set upload tab bar item icon 53 | */ 54 | - (void)updateUploadTabbarItem { 55 | UITabBarItem *item = [self.tabBar.items objectAtIndex:1]; 56 | item.image = [[UIImage imageNamed:@"tab_oval"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | /* 65 | #pragma mark - Navigation 66 | 67 | // In a storyboard-based application, you will often want to do a little preparation before navigation 68 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 69 | // Get the new view controller using [segue destinationViewController]. 70 | // Pass the selected object to the new view controller. 71 | } 72 | */ 73 | 74 | #pragma mark - UITabBarControllerDelegate 75 | 76 | - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController NS_AVAILABLE_IOS(3_0) { 77 | 78 | // if selecting upload tab item 79 | if ([viewController isEqual:self.viewControllers[1]]) { 80 | // go to upload page manually 81 | [self.navigationController pushViewController:viewController animated:YES]; 82 | 83 | return NO; 84 | } 85 | 86 | return YES; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Playground/Helpers/PHTextHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // PHTextHelper.m 3 | // Playground 4 | // 5 | // Created by Administrator on 1/12/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PHTextHelper.h" 10 | #import "PHColorHelper.h" 11 | #import "PHUiHelper.h" 12 | 13 | @implementation PHTextHelper 14 | 15 | + (NSInteger)fontSizeSmall { 16 | return 11; 17 | } 18 | 19 | + (NSInteger)fontSizeMedium { 20 | return 13; 21 | } 22 | 23 | + (NSInteger)fontSizeNormal { 24 | return 15; 25 | } 26 | 27 | + (NSInteger)fontSizeNormalLarge { 28 | return 22; 29 | } 30 | 31 | + (NSInteger)fontSizeSemiLarge { 32 | return 30; 33 | } 34 | 35 | + (NSInteger)fontSizeLarge { 36 | return 40; 37 | } 38 | 39 | + (NSInteger)fontNoticeSmall { 40 | return 20; 41 | } 42 | 43 | + (NSInteger)fontNoticeMedium { 44 | return 24; 45 | } 46 | 47 | 48 | + (UIFont*)myriadProRegular:(CGFloat)size { 49 | return [UIFont fontWithName:@"MyriadPro-Regular" size:size]; 50 | } 51 | 52 | + (UIFont*)myriadProBold:(CGFloat)size { 53 | return [UIFont fontWithName:@"MyriadPro-Bold" size:size]; 54 | } 55 | 56 | + (UIFont*)myriadProBlack:(CGFloat)size { 57 | return [UIFont fontWithName:@"MyriadPro-Black" size:size]; 58 | } 59 | 60 | + (UIFont*)myriadProLight:(CGFloat)size { 61 | return [UIFont fontWithName:@"MyriadPro-Light" size:size]; 62 | } 63 | 64 | + (UIFont*)myriadProSemibold:(CGFloat)size { 65 | return [UIFont fontWithName:@"MyriadPro-Semibold" size:size]; 66 | } 67 | 68 | 69 | 70 | /** 71 | set textfield placeholder color 72 | @param textfield <#textfield description#> 73 | */ 74 | + (void)setGrayPlaceHolder:(UITextField *)textfield { 75 | 76 | // check validity 77 | if (![textfield respondsToSelector:@selector(setAttributedPlaceholder:)]) { 78 | return; 79 | } 80 | 81 | if (!textfield.placeholder) { 82 | return; 83 | } 84 | 85 | UIColor *colorGray = [PHColorHelper colorTextGray]; 86 | textfield.attributedPlaceholder = [[NSAttributedString alloc] initWithString:textfield.placeholder 87 | attributes:@{NSForegroundColorAttributeName:colorGray}]; 88 | } 89 | 90 | /** 91 | initialize text field with regular font 92 | @param textfield <#textfield description#> 93 | */ 94 | + (void)initTextRegular:(UITextField *)textfield { 95 | // font 96 | UIFont *fontRegular = [PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]; 97 | [textfield setFont:fontRegular]; 98 | 99 | // placeholder 100 | [self setGrayPlaceHolder:textfield]; 101 | } 102 | 103 | /** 104 | initialize text field with bold font 105 | @param textfield <#textfield description#> 106 | */ 107 | + (void)initTextBold:(UITextField *)textfield { 108 | // font 109 | UIFont *fontBold = [PHTextHelper myriadProBold:[PHTextHelper fontSizeNormal]]; 110 | [textfield setFont:fontBold]; 111 | 112 | // placeholder 113 | [self setGrayPlaceHolder:textfield]; 114 | } 115 | 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/SettingsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "SettingsViewController.h" 10 | #import "PHTextHelper.h" 11 | #import "PCAlertDialog.h" 12 | #import "CommonUtils.h" 13 | #import "UserData.h" 14 | 15 | @interface SettingsViewController () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 18 | 19 | @property (weak, nonatomic) IBOutlet UIButton *mButEditProfile; 20 | @property (weak, nonatomic) IBOutlet UIButton *mButEditSetting; 21 | @property (weak, nonatomic) IBOutlet UIButton *mButEditNotification; 22 | @property (weak, nonatomic) IBOutlet UIButton *mButRestartTutorial; 23 | @property (weak, nonatomic) IBOutlet UIButton *mButDeleteAccount; 24 | @property (weak, nonatomic) IBOutlet UIButton *mButLogOut; 25 | 26 | @end 27 | 28 | @implementation SettingsViewController 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | // font 34 | [self.mLblTitle setFont:[PHTextHelper myriadProBlack:[PHTextHelper fontSizeLarge]]]; 35 | 36 | double dFontSize = [PHTextHelper fontSizeNormal]; 37 | 38 | [self.mButEditProfile.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 39 | [self.mButEditSetting.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 40 | [self.mButEditNotification.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 41 | [self.mButRestartTutorial.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 42 | [self.mButDeleteAccount.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 43 | [self.mButLogOut.titleLabel setFont:[PHTextHelper myriadProBold:dFontSize]]; 44 | 45 | // hide tab bar 46 | [self.tabBarController.tabBar setHidden:YES]; 47 | } 48 | 49 | - (void)didReceiveMemoryWarning { 50 | [super didReceiveMemoryWarning]; 51 | // Dispose of any resources that can be recreated. 52 | } 53 | 54 | /* 55 | #pragma mark - Navigation 56 | 57 | // In a storyboard-based application, you will often want to do a little preparation before navigation 58 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 59 | // Get the new view controller using [segue destinationViewController]. 60 | // Pass the selected object to the new view controller. 61 | } 62 | */ 63 | 64 | - (IBAction)onButDeleteAccount:(id)sender { 65 | PCAlertDialog *viewAlert = [PCAlertDialog getView]; 66 | viewAlert.frame = self.view.bounds; 67 | 68 | // set content 69 | [viewAlert setTitle:@"Delete account"]; 70 | [viewAlert setMessage:@""]; 71 | [viewAlert setPrimaryButName:@"Delete"]; 72 | 73 | [self.view addSubview:viewAlert]; 74 | 75 | [viewAlert showView:YES animated:YES]; 76 | } 77 | 78 | - (IBAction)onButLogout:(id)sender { 79 | [self.navigationController popToRootViewControllerAnimated:YES]; 80 | 81 | // back to login page 82 | [self.tabBarController.navigationController popViewControllerAnimated:YES]; 83 | 84 | // clear current user 85 | [UserData setCurrentUser:nil]; 86 | 87 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 88 | [defaults setObject:nil forKey:kCurrentUser]; 89 | [defaults synchronize]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Playground/Lib/PlaceholderTextView/PlaceholderTextView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PlaceholderTextView.m 3 | // 4 | 5 | #import "PlaceholderTextView.h" 6 | 7 | @interface PlaceholderTextView () 8 | 9 | @property (nonatomic, retain) UILabel *placeHolderLabel; 10 | 11 | @end 12 | 13 | @implementation PlaceholderTextView 14 | 15 | - (void)dealloc 16 | { 17 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 18 | #if __has_feature(objc_arc) 19 | #else 20 | [_placeHolderLabel release]; _placeHolderLabel = nil; 21 | [_placeholderColor release]; _placeholderColor = nil; 22 | [_placeholder release]; _placeholder = nil; 23 | [super dealloc]; 24 | #endif 25 | } 26 | 27 | - (void)awakeFromNib 28 | { 29 | [super awakeFromNib]; 30 | 31 | // Use Interface Builder User Defined Runtime Attributes to set 32 | // placeholder and placeholderColor in Interface Builder. 33 | if (!self.placeholder) { 34 | [self setPlaceholder:@""]; 35 | } 36 | 37 | if (!self.placeholderColor) { 38 | [self setPlaceholderColor:[UIColor lightGrayColor]]; 39 | } 40 | 41 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; 42 | } 43 | 44 | - (id)initWithFrame:(CGRect)frame 45 | { 46 | if( (self = [super initWithFrame:frame]) ) 47 | { 48 | [self setPlaceholder:@""]; 49 | [self setPlaceholderColor:[UIColor lightGrayColor]]; 50 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; 51 | } 52 | 53 | return self; 54 | } 55 | 56 | - (void)textChanged:(NSNotification *)notification 57 | { 58 | if([[self placeholder] length] == 0) 59 | { 60 | return; 61 | } 62 | 63 | if([[self text] length] == 0) 64 | { 65 | [[self viewWithTag:999] setAlpha:1]; 66 | } 67 | else 68 | { 69 | [[self viewWithTag:999] setAlpha:0]; 70 | } 71 | } 72 | 73 | - (void)setText:(NSString *)text { 74 | [super setText:text]; 75 | [self textChanged:nil]; 76 | } 77 | 78 | - (void)drawRect:(CGRect)rect 79 | { 80 | if( [[self placeholder] length] > 0 ) 81 | { 82 | if (_placeHolderLabel == nil ) 83 | { 84 | _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(8,8,self.bounds.size.width - 16,0)]; 85 | _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping; 86 | _placeHolderLabel.numberOfLines = 0; 87 | _placeHolderLabel.font = self.font; 88 | _placeHolderLabel.backgroundColor = [UIColor clearColor]; 89 | _placeHolderLabel.textColor = self.placeholderColor; 90 | _placeHolderLabel.alpha = 0; 91 | _placeHolderLabel.tag = 999; 92 | [self addSubview:_placeHolderLabel]; 93 | } 94 | 95 | _placeHolderLabel.text = self.placeholder; 96 | [_placeHolderLabel sizeToFit]; 97 | [self sendSubviewToBack:_placeHolderLabel]; 98 | } 99 | 100 | if( [[self text] length] == 0 && [[self placeholder] length] > 0 ) 101 | { 102 | [[self viewWithTag:999] setAlpha:1]; 103 | } 104 | 105 | [super drawRect:rect]; 106 | 107 | } 108 | 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Playground/Helpers/PHUiHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // PHUiHelper.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/14/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PHUiHelper.h" 10 | 11 | 12 | @implementation PHUiHelper 13 | 14 | 15 | /** 16 | determine iphone devices 17 | @return <#return value description#> 18 | */ 19 | + (PHDeviceType) deviceType { 20 | PHDeviceType nResult = PHDevice_iPhoneStandard; 21 | 22 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){ 23 | if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) { 24 | // get screen size 25 | CGSize result = [[UIScreen mainScreen] bounds].size; 26 | 27 | // get resolution 28 | // result = CGSizeMake(result.width * [UIScreen mainScreen].scale, result.height * [UIScreen mainScreen].scale); 29 | 30 | if (result.height >= 736.0f) 31 | nResult = PHDevice_iPhone6Plus; 32 | else if (result.height >= 667.0f) 33 | nResult = PHDevice_iPhone6; 34 | else if (result.height >= 568.0f) 35 | nResult = PHDevice_iPhone5; 36 | } 37 | } 38 | else { 39 | nResult = PHDevice_Other; 40 | } 41 | 42 | return nResult; 43 | } 44 | 45 | 46 | /** 47 | show alert view 48 | @param viewController <#viewController description#> 49 | @param message <#message description#> 50 | */ 51 | + (void)showAlertView:(UIViewController *)viewController message:(NSString *)message { 52 | 53 | UIAlertController *ac = [UIAlertController alertControllerWithTitle:message 54 | message:@"" 55 | preferredStyle:UIAlertControllerStyleAlert]; 56 | 57 | // ok button 58 | UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" 59 | style:UIAlertActionStyleCancel 60 | handler:nil]; 61 | [ac addAction:okAction]; 62 | 63 | [viewController presentViewController:ac animated:YES completion:nil]; 64 | } 65 | 66 | + (void)showAlertView:(UIViewController *)viewController title:(NSString *)title message:(NSString *)message { 67 | 68 | UIAlertController *ac = [UIAlertController alertControllerWithTitle:title 69 | message:message 70 | preferredStyle:UIAlertControllerStyleAlert]; 71 | 72 | // ok button 73 | UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" 74 | style:UIAlertActionStyleCancel 75 | handler:nil]; 76 | [ac addAction:okAction]; 77 | 78 | [viewController presentViewController:ac animated:YES completion:nil]; 79 | } 80 | 81 | 82 | + (CGFloat) marginLeftNormal { 83 | return 16.0f; 84 | } 85 | 86 | + (void)makeRounded:(UIView *)view { 87 | [view.layer setMasksToBounds:YES]; 88 | [view.layer setCornerRadius:view.frame.size.height/2.0]; 89 | } 90 | 91 | + (void)setPurpleBorder:(UIView *)view cornerRadius:(double)radius { 92 | 93 | // make border 94 | [view.layer setMasksToBounds:YES]; 95 | [view.layer setBorderColor:[UIColor colorWithRed:122/255.0 96 | green:167/255.0 97 | blue:244/255.0 98 | alpha:1.0].CGColor]; 99 | [view.layer setBorderWidth:1.0f]; 100 | 101 | [view.layer setCornerRadius:radius]; 102 | } 103 | 104 | + (UIImage *)blueBackground { 105 | return [UIImage imageNamed:@"blue_bg"]; 106 | } 107 | 108 | + (UIImage *)redBackground { 109 | return [UIImage imageNamed:@"red_bg"]; 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/RateViewController/RateViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RateViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "RateViewController.h" 10 | #import "PHTextHelper.h" 11 | #import "PHColorHelper.h" 12 | #import "PHUiHelper.h" 13 | #import "PCRateView.h" 14 | 15 | #import 16 | 17 | #import "UserData.h" 18 | #import "ItemData.h" 19 | 20 | #import "ApiManager.h" 21 | 22 | 23 | @interface RateViewController () { 24 | PCRateView *mViewRateCore; 25 | ItemData *mItem; 26 | } 27 | 28 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 29 | @property (weak, nonatomic) IBOutlet UIImageView *mImgviewUser; 30 | @property (weak, nonatomic) IBOutlet UILabel *mLblUsername; 31 | @property (weak, nonatomic) IBOutlet UILabel *mLblItemname; 32 | @property (weak, nonatomic) IBOutlet UIView *mViewRate; 33 | @property (weak, nonatomic) IBOutlet UIButton *mButRate; 34 | 35 | @end 36 | 37 | @implementation RateViewController 38 | 39 | - (void)viewDidLoad { 40 | [super viewDidLoad]; 41 | 42 | // label 43 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeLarge]]]; 44 | [self.mLblUsername setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeSemiLarge]]]; 45 | [self.mLblItemname setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 46 | 47 | // photo 48 | [self.mImgviewUser.layer setBorderWidth:0.5]; 49 | [self.mImgviewUser.layer setBorderColor:[PHColorHelper colorTextGray].CGColor]; 50 | 51 | // button 52 | [self.mButRate.titleLabel setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 53 | 54 | // rate view 55 | mViewRateCore = [PCRateView getView]; 56 | mViewRateCore.frame = self.mViewRate.bounds; 57 | [self.mViewRate addSubview:mViewRateCore]; 58 | 59 | // 60 | // set contents 61 | // 62 | 63 | // user & item data 64 | [self.mImgviewUser sd_setImageWithURL:[NSURL URLWithString:[mItem.user photoUrl]]]; 65 | [self.mLblUsername setText:mItem.username]; 66 | [self.mLblItemname setText:mItem.title]; 67 | 68 | // rate 69 | [mViewRateCore setRate:mItem.rate]; 70 | 71 | // if already rated, no allowed to rate again 72 | if (mItem.rate > 0) { 73 | [self disableRateButton]; 74 | } 75 | } 76 | 77 | /** 78 | disable rate button and rate view 79 | */ 80 | - (void)disableRateButton { 81 | [mViewRateCore setUserInteractionEnabled:NO]; 82 | [self.mButRate setEnabled:NO]; 83 | } 84 | 85 | - (void)didReceiveMemoryWarning { 86 | [super didReceiveMemoryWarning]; 87 | // Dispose of any resources that can be recreated. 88 | } 89 | 90 | - (void)viewWillLayoutSubviews { 91 | [super viewWillLayoutSubviews]; 92 | 93 | [PHUiHelper makeRounded:self.mImgviewUser]; 94 | [PHUiHelper makeRounded:self.mButRate]; 95 | } 96 | 97 | - (void)setItemData:(id)item { 98 | mItem = item; 99 | } 100 | 101 | /* 102 | #pragma mark - Navigation 103 | 104 | // In a storyboard-based application, you will often want to do a little preparation before navigation 105 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 106 | // Get the new view controller using [segue destinationViewController]. 107 | // Pass the selected object to the new view controller. 108 | } 109 | */ 110 | 111 | - (IBAction)onButRate:(id)sender { 112 | // 113 | // call rate api 114 | // 115 | [[ApiManager sharedInstance] rateItemWithId:mItem.id 116 | rate:[mViewRateCore getRate] 117 | success:^(id response) 118 | { 119 | } 120 | fail:^(NSError *error, id response) 121 | { 122 | }]; 123 | 124 | [mItem setRate:[mViewRateCore getRate]]; 125 | [self disableRateButton]; 126 | } 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /Playground/View/ProfileViewController/ChatViewController/ChatViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ChatViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/15/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "ChatViewController.h" 10 | #import "ChatCell.h" 11 | #import "PCBorderView.h" 12 | #import "PHTextHelper.h" 13 | 14 | @interface ChatViewController () { 15 | NSString *mstrCellId; 16 | } 17 | 18 | @property (weak, nonatomic) IBOutlet UITableView *mTableView; 19 | @property (weak, nonatomic) IBOutlet PCBorderView *mViewInput; 20 | @property (weak, nonatomic) IBOutlet UITextField *mTextInput; 21 | 22 | @end 23 | 24 | @implementation ChatViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | // nav bar 30 | [self showTitle:YES]; 31 | [self initTableView:self.mTableView haveBottombar:YES]; 32 | 33 | // table view 34 | self.mTableView.estimatedRowHeight = UITableViewAutomaticDimension; 35 | 36 | // init param 37 | mstrCellId = @"ChatTableCell"; 38 | 39 | // input view 40 | [self.mViewInput removeBottom]; 41 | [PHTextHelper initTextRegular:self.mTextInput]; 42 | 43 | // keyboard event 44 | [self enableKeyboardNotification]; 45 | } 46 | 47 | - (void)didReceiveMemoryWarning { 48 | [super didReceiveMemoryWarning]; 49 | // Dispose of any resources that can be recreated. 50 | } 51 | 52 | /* 53 | #pragma mark - Navigation 54 | 55 | // In a storyboard-based application, you will often want to do a little preparation before navigation 56 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 57 | // Get the new view controller using [segue destinationViewController]. 58 | // Pass the selected object to the new view controller. 59 | } 60 | */ 61 | 62 | /** 63 | scroll to the bottom of the table view 64 | @param animated <#animated description#> 65 | */ 66 | - (void)scrollToBottomAnimated:(BOOL)animated 67 | { 68 | NSInteger rows = [self.mTableView numberOfRowsInSection:0]; 69 | 70 | if(rows > 0) { 71 | [self.mTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:rows - 1 inSection:0] 72 | atScrollPosition:UITableViewScrollPositionBottom 73 | animated:animated]; 74 | } 75 | } 76 | 77 | 78 | 79 | /** 80 | make and fill contents for cell 81 | @param tableView <#tableview description#> 82 | @param index <#index description#> 83 | @return <#return value description#> 84 | */ 85 | - (ChatCell *)configureChatCell:(UITableView *)tableView index:(NSInteger)index { 86 | ChatCell *cellChat = (ChatCell *)[tableView dequeueReusableCellWithIdentifier:mstrCellId]; 87 | 88 | if (index == 0) { 89 | [cellChat showTime:YES]; 90 | } 91 | else if (index == 1) { 92 | [cellChat showTime:NO]; 93 | } 94 | 95 | return cellChat; 96 | } 97 | 98 | #pragma mark - UITableViewDataSource 99 | 100 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 101 | return 2; 102 | } 103 | 104 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 105 | 106 | ChatCell *cellChat = [self configureChatCell:tableView index:indexPath.row];; 107 | 108 | return cellChat; 109 | } 110 | 111 | #pragma mark - UITableViewDelegate 112 | 113 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 114 | ChatCell *cellChat = [self configureChatCell:tableView index:indexPath.row];; 115 | double dHeight = [cellChat.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; 116 | 117 | return dHeight; 118 | } 119 | 120 | #pragma mark - UITextFieldDelegate 121 | 122 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 123 | [super textFieldShouldReturn:textField]; 124 | [textField setText:@""]; 125 | 126 | return YES; 127 | } 128 | 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticeTimeout/PCNoticeTimeout.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCNotice/PCNoticePrice/PCNoticePrice.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Playground/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCUploadView/PCUploadView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCUploadView/PCUploadViewBottom.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidItemCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidItemCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidItemCell.h" 10 | #import "PCItemView.h" 11 | #import "BidViewController.h" 12 | #import "PHTextHelper.h" 13 | #import "PHUiHelper.h" 14 | #import "ItemData.h" 15 | #import "UserData.h" 16 | 17 | @interface BidItemCell() { 18 | NSMutableArray *maryButTab; 19 | NSMutableArray *maryImgNormal; 20 | NSMutableArray *maryImgSelected; 21 | 22 | PCItemView *mViewItemCore; 23 | } 24 | 25 | @property (weak, nonatomic) IBOutlet UIView *mViewItem; 26 | @property (weak, nonatomic) IBOutlet UILabel *mLblItemname; 27 | @property (weak, nonatomic) IBOutlet UILabel *mLblUsername; 28 | 29 | @property (weak, nonatomic) IBOutlet UIButton *mButBid; 30 | 31 | @property (weak, nonatomic) IBOutlet UIButton *mButDesc; 32 | @property (weak, nonatomic) IBOutlet UIButton *mButPhoto; 33 | @property (weak, nonatomic) IBOutlet UIButton *mButComment; 34 | 35 | @end 36 | 37 | @implementation BidItemCell 38 | 39 | - (void)awakeFromNib { 40 | [super awakeFromNib]; 41 | 42 | // add item view 43 | mViewItemCore = [PCItemView getView]; 44 | mViewItemCore.frame = self.mViewItem.bounds; 45 | 46 | [self.mViewItem addSubview:mViewItemCore]; 47 | 48 | // font 49 | [self.mLblItemname setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 50 | [self.mLblUsername setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeSmall]]]; 51 | [self.mButBid.titleLabel setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeMedium]]]; 52 | 53 | // 54 | // tab buttons 55 | // 56 | maryButTab = [[NSMutableArray alloc] init]; 57 | maryImgNormal = [[NSMutableArray alloc] init]; 58 | maryImgSelected = [[NSMutableArray alloc] init]; 59 | 60 | // add button objects 61 | [maryButTab addObject:self.mButDesc]; 62 | [maryImgNormal addObject:@"bid_desc"]; 63 | [maryImgSelected addObject:@"bid_desc_selected"]; 64 | 65 | [maryButTab addObject:self.mButPhoto]; 66 | [maryImgNormal addObject:@"bid_photo"]; 67 | [maryImgSelected addObject:@"bid_photo_selected"]; 68 | 69 | [maryButTab addObject:self.mButComment]; 70 | [maryImgNormal addObject:@"bid_comment"]; 71 | [maryImgSelected addObject:@"bid_comment_selected"]; 72 | 73 | for (UIButton *button in maryButTab) { 74 | [button addTarget:self action:@selector(onButTab:) forControlEvents:UIControlEventTouchUpInside]; 75 | } 76 | } 77 | 78 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 79 | [super setSelected:selected animated:animated]; 80 | 81 | // Configure the view for the selected state 82 | } 83 | 84 | /** 85 | event handler for tab buttons 86 | @param sender tab button 87 | */ 88 | - (void)onButTab:(id)sender { 89 | NSInteger nTag = ((UIButton *)sender).tag; 90 | 91 | int nTab = (int)nTag; 92 | 93 | // update view content 94 | BidViewController *viewController = (BidViewController *)self.delegate; 95 | [viewController setSelectedTab:nTab]; 96 | 97 | // init button icon with normal image 98 | int i = 0; 99 | for (i = 0; i < [maryButTab count]; i++) { 100 | UIButton *button = maryButTab[i]; 101 | [button setImage:[UIImage imageNamed:maryImgNormal[i]] forState:UIControlStateNormal]; 102 | } 103 | 104 | // set selected button icon 105 | UIButton *button = maryButTab[nTab]; 106 | [button setImage:[UIImage imageNamed:maryImgSelected[nTab]] forState:UIControlStateNormal]; 107 | } 108 | 109 | - (void)fillContent:(id)data { 110 | ItemData *item = (ItemData *)data; 111 | 112 | // photo 113 | [mViewItemCore setItemData:data]; 114 | 115 | // label data 116 | [self.mLblItemname setText:item.title]; 117 | [self.mLblUsername setText:item.username]; 118 | 119 | // disable bid button if it is his own 120 | if ([item isMine]) { 121 | [self.mButBid setEnabled:NO]; 122 | } 123 | 124 | } 125 | 126 | - (void)layoutSubviews { 127 | [super layoutSubviews]; 128 | 129 | // bid button 130 | [PHUiHelper makeRounded:self.mButBid]; 131 | } 132 | 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Playground/View/SettingsViewController/EditSettingViewController/EditSettingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // EditSettingViewController.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/18/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "EditSettingViewController.h" 10 | #import "PHTextHelper.h" 11 | #import "UserData.h" 12 | #import "PHUiHelper.h" 13 | #import "ApiManager.h" 14 | #import "ApiConfig.h" 15 | 16 | @interface EditSettingViewController () 17 | 18 | @property (weak, nonatomic) IBOutlet UITextField *mTxtEmail; 19 | @property (weak, nonatomic) IBOutlet UITextField *mTxtPswdOld; 20 | @property (weak, nonatomic) IBOutlet UITextField *mTxtPswdNew; 21 | @property (weak, nonatomic) IBOutlet UITextField *mTxtPswdRetype; 22 | 23 | @property (weak, nonatomic) IBOutlet UILabel *mLblSocial; 24 | @property (weak, nonatomic) IBOutlet UILabel *mLblFacebook; 25 | @property (weak, nonatomic) IBOutlet UILabel *mLblTwitter; 26 | 27 | @end 28 | 29 | @implementation EditSettingViewController 30 | 31 | - (void)viewDidLoad { 32 | [super viewDidLoad]; 33 | 34 | // init text field 35 | [PHTextHelper initTextBold:self.mTxtEmail]; 36 | [PHTextHelper initTextBold:self.mTxtPswdOld]; 37 | [PHTextHelper initTextBold:self.mTxtPswdNew]; 38 | [PHTextHelper initTextBold:self.mTxtPswdRetype]; 39 | 40 | // label 41 | [self.mLblSocial setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 42 | [self.mLblFacebook setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeNormal]]]; 43 | [self.mLblTwitter setFont:[PHTextHelper myriadProBold:[PHTextHelper fontSizeNormal]]]; 44 | 45 | // set content 46 | UserData *user = [UserData currentUser]; 47 | [self.mTxtEmail setText:user.email]; 48 | } 49 | 50 | - (void)didReceiveMemoryWarning { 51 | [super didReceiveMemoryWarning]; 52 | // Dispose of any resources that can be recreated. 53 | } 54 | 55 | /* 56 | #pragma mark - Navigation 57 | 58 | // In a storyboard-based application, you will often want to do a little preparation before navigation 59 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 60 | // Get the new view controller using [segue destinationViewController]. 61 | // Pass the selected object to the new view controller. 62 | } 63 | */ 64 | 65 | /** 66 | back to prev page 67 | @param sender sender description 68 | */ 69 | - (void)onButBack:(id)sender { 70 | 71 | UserData *user = [UserData currentUser]; 72 | 73 | // ------ Edit setting, save 74 | 75 | // check data validity 76 | if (self.mTxtEmail.text.length == 0) { 77 | [PHUiHelper showAlertView:self message:@"Input your email"]; 78 | return; 79 | } 80 | if (self.mTxtPswdNew.text.length > 0 && ![self.mTxtPswdNew.text isEqualToString:self.mTxtPswdRetype.text]) { 81 | [PHUiHelper showAlertView:self message:@"Password does not match"]; 82 | return; 83 | } 84 | 85 | // save profile 86 | [[ApiManager sharedInstance] saveSettingwithEmail:self.mTxtEmail.text 87 | password:self.mTxtPswdNew.text 88 | oldpassword:self.mTxtPswdOld.text 89 | success:^(id response) 90 | { 91 | [user updateProfile:response]; 92 | [UserData setCurrentUser:user]; 93 | 94 | // go to prev page 95 | [super onButBack:sender]; 96 | 97 | } 98 | fail:^(NSError *error, id response) 99 | { 100 | // close keyboard 101 | [self.view endEditing:YES]; 102 | 103 | [PHUiHelper showAlertView:self title:@"Update Failed" message:[ApiManager getErrorDescription:error response:response]]; 104 | }]; 105 | } 106 | 107 | 108 | #pragma mark - UITextFieldDelegate 109 | 110 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 111 | 112 | if (textField == self.mTxtEmail) { 113 | [textField resignFirstResponder]; 114 | } 115 | else if (textField == self.mTxtPswdOld) { 116 | [self.mTxtPswdNew becomeFirstResponder]; 117 | } 118 | else if (textField == self.mTxtPswdNew) { 119 | [self.mTxtPswdRetype becomeFirstResponder]; 120 | } 121 | else if (textField == self.mTxtPswdRetype) { 122 | [textField resignFirstResponder]; 123 | } 124 | 125 | return YES; 126 | } 127 | 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /Playground/View/BidViewController/BidDescCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // BidDescCell.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/16/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "BidDescCell.h" 10 | #import "PHTextHelper.h" 11 | #import "PCRateView.h" 12 | #import "PCNoticeTimeout.h" 13 | #import "PCNoticePrice.h" 14 | #import "PHColorHelper.h" 15 | #import "PHUiHelper.h" 16 | #import "ItemData.h" 17 | 18 | @interface BidDescCell() { 19 | PCNoticeTimeout *mViewTimeoutCore; 20 | PCNoticePrice *mViewAuctionCore; 21 | PCNoticePrice *mViewBidCore; 22 | PCRateView *mViewRateCore; 23 | } 24 | 25 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 26 | @property (weak, nonatomic) IBOutlet UILabel *mLblContent; 27 | 28 | @property (weak, nonatomic) IBOutlet UILabel *mLblCondition; 29 | @property (weak, nonatomic) IBOutlet UIView *mViewRate; 30 | 31 | @property (weak, nonatomic) IBOutlet UIView *mViewTime; 32 | 33 | @property (weak, nonatomic) IBOutlet UIView *mViewAuction; 34 | @property (weak, nonatomic) IBOutlet UIView *mViewBid; 35 | 36 | @property (weak, nonatomic) IBOutlet UILabel *mLblShare; 37 | 38 | @end 39 | 40 | @implementation BidDescCell 41 | 42 | - (void)awakeFromNib { 43 | [super awakeFromNib]; 44 | 45 | // 46 | // font 47 | // 48 | [self.mLblTitle setFont:[PHTextHelper myriadProSemibold:[PHTextHelper fontSizeNormal]]]; 49 | [self.mLblContent setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 50 | 51 | [self.mLblCondition setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 52 | 53 | [self.mLblShare setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 54 | 55 | // 56 | // add timeout view 57 | // 58 | mViewTimeoutCore = [PCNoticeTimeout getView]; 59 | 60 | // Set the width of the cell to match the width of the container view 61 | mViewTimeoutCore.frame = self.mViewTime.bounds; 62 | [self.mViewTime addSubview:mViewTimeoutCore]; 63 | 64 | // 65 | // add auction view 66 | // 67 | mViewAuctionCore = [PCNoticePrice getView]; 68 | mViewAuctionCore.frame = self.mViewAuction.bounds; 69 | [self.mViewAuction addSubview:mViewAuctionCore]; 70 | 71 | // 72 | // add bid view 73 | // 74 | mViewBidCore = [PCNoticePrice getView]; 75 | mViewBidCore.frame = self.mViewBid.bounds; 76 | [mViewBidCore setTitle:@"Current Bid"]; 77 | [mViewBidCore setValueText:@"$220"]; 78 | [mViewBidCore setBackgroundImage:[PHUiHelper redBackground]]; 79 | 80 | [self.mViewBid addSubview:mViewBidCore]; 81 | 82 | // 83 | // add rate view 84 | // 85 | mViewRateCore = [PCRateView getView]; 86 | mViewRateCore.frame = self.mViewRate.bounds; 87 | [mViewRateCore setUserInteractionEnabled:NO]; 88 | [self.mViewRate addSubview:mViewRateCore]; 89 | } 90 | 91 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 92 | [super setSelected:selected animated:animated]; 93 | 94 | // Configure the view for the selected state 95 | } 96 | 97 | - (void)layoutSubviews 98 | { 99 | [super layoutSubviews]; 100 | 101 | // Make sure the contentView does a layout pass here so that its subviews have their frames set, which we 102 | // need to use to set the preferredMaxLayoutWidth below. 103 | [self.contentView setNeedsLayout]; 104 | [self.contentView layoutIfNeeded]; 105 | 106 | 107 | // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame, 108 | // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height. 109 | self.mLblTitle.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblTitle.frame); 110 | self.mLblContent.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblContent.frame); 111 | } 112 | 113 | - (void)fillContent:(id)data { 114 | ItemData *item = (ItemData *)data; 115 | 116 | // description 117 | [self.mLblContent setText:item.desc]; 118 | 119 | // condition 120 | [mViewRateCore setRate:item.condition]; 121 | 122 | // time remaining 123 | [mViewTimeoutCore setValueText:[item remainTimeLong]]; 124 | 125 | // price 126 | [mViewAuctionCore setValueText:[NSString stringWithFormat:@"$%ld", (long)item.price]]; 127 | 128 | // bid price 129 | [mViewBidCore setValueText:[NSString stringWithFormat:@"$%ld", (long)[item getMaxBidPrice]]]; 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Playground/View/CustomUI/PCAlertDialog/PCAlertDialog.m: -------------------------------------------------------------------------------- 1 | // 2 | // PCAlertDialog.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/17/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "PCAlertDialog.h" 10 | #import "PHTextHelper.h" 11 | #import "PHUiHelper.h" 12 | 13 | @interface PCAlertDialog() 14 | 15 | @property (weak, nonatomic) IBOutlet UIView *mViewContent; 16 | @property (weak, nonatomic) IBOutlet UILabel *mLblTitle; 17 | @property (weak, nonatomic) IBOutlet UILabel *mLblMessage; 18 | 19 | @property (weak, nonatomic) IBOutlet UIButton *mButPrimary; 20 | @property (weak, nonatomic) IBOutlet UIButton *mButCancel; 21 | 22 | @end 23 | 24 | @implementation PCAlertDialog 25 | 26 | /* 27 | // Only override drawRect: if you perform custom drawing. 28 | // An empty implementation adversely affects performance during animation. 29 | - (void)drawRect:(CGRect)rect { 30 | // Drawing code 31 | } 32 | */ 33 | 34 | - (void)awakeFromNib { 35 | [super awakeFromNib]; 36 | 37 | // content view 38 | [self.mViewContent.layer setMasksToBounds:YES]; 39 | [self.mViewContent.layer setCornerRadius:8]; 40 | 41 | // title 42 | [self.mLblTitle setFont:[PHTextHelper myriadProBold:18]]; 43 | 44 | // message 45 | [self.mLblMessage setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 46 | 47 | // primary button 48 | [self.mButPrimary.titleLabel setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 49 | 50 | // cancel button 51 | [self.mButCancel.titleLabel setFont:[PHTextHelper myriadProRegular:[PHTextHelper fontSizeNormal]]]; 52 | 53 | // add tap guesture 54 | if ([self.gestureRecognizers count] == 0) { 55 | UITapGestureRecognizer *singleTapRecognizer = [[UITapGestureRecognizer alloc] 56 | initWithTarget:self action:@selector(didRecognizeSingleTap:)]; 57 | [singleTapRecognizer setNumberOfTapsRequired:1]; 58 | [self addGestureRecognizer:singleTapRecognizer]; 59 | } 60 | 61 | // init alpha 62 | [self setAlpha:0]; 63 | } 64 | 65 | - (void)layoutSubviews { 66 | [super layoutSubviews]; 67 | 68 | // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame, 69 | // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height. 70 | self.mLblMessage.preferredMaxLayoutWidth = CGRectGetWidth(self.mLblMessage.frame); 71 | 72 | [PHUiHelper makeRounded:self.mButPrimary]; 73 | } 74 | 75 | - (void)updateConstraints { 76 | [super updateConstraints]; 77 | } 78 | 79 | + (id)getView { 80 | // primary button 81 | return [super getView:@"PCAlertDialog"]; 82 | } 83 | 84 | /** 85 | set title of the alert 86 | @param value <#value description#> 87 | */ 88 | - (void)setTitle:(NSString *)value { 89 | [self.mLblTitle setText:value]; 90 | } 91 | 92 | /** 93 | set message of the alert 94 | @param value <#value description#> 95 | */ 96 | - (void)setMessage:(NSString *)value { 97 | [self.mLblMessage setText:value]; 98 | } 99 | 100 | /** 101 | set title of the primary button 102 | @param value <#value description#> 103 | */ 104 | - (void)setPrimaryButName:(NSString *)value { 105 | [self.mButPrimary setTitle:value forState:UIControlStateNormal]; 106 | } 107 | 108 | /** 109 | show/hide alert dialog 110 | @param bShow <#bShow description#> 111 | @param animated <#animated description#> 112 | */ 113 | - (void)showView:(BOOL)bShow animated:(BOOL)animated { 114 | 115 | if (animated) { 116 | [UIView animateWithDuration:0.3 117 | animations:^{ 118 | [self setHidden:NO]; 119 | [self setAlpha:bShow]; 120 | }completion:^(BOOL finished) { 121 | [self setHidden:!bShow]; 122 | }]; 123 | } 124 | else { 125 | [self setAlpha:bShow]; 126 | [self setHidden:!bShow]; 127 | } 128 | } 129 | 130 | - (void)didRecognizeSingleTap:(id)sender 131 | { 132 | [self showView:NO animated:YES]; 133 | } 134 | 135 | - (IBAction)onButCancel:(id)sender { 136 | [self showView:NO animated:YES]; 137 | } 138 | 139 | - (IBAction)onButPrimary:(id)sender { 140 | 141 | // do operation 142 | if (!self.delegate) { 143 | return; 144 | } 145 | 146 | if ([self.delegate respondsToSelector:@selector(onButAlertPrimary)]) { 147 | [self.delegate onButAlertPrimary]; 148 | } 149 | 150 | [self showView:NO animated:YES]; 151 | } 152 | 153 | @end 154 | -------------------------------------------------------------------------------- /Playground.xcodeproj/xcuserdata/Administrator.xcuserdatad/xcschemes/Playground.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Playground/Model/UserData.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserData.m 3 | // Playground 4 | // 5 | // Created by Top1 on 1/27/17. 6 | // Copyright © 2017 fred. All rights reserved. 7 | // 8 | 9 | #import "UserData.h" 10 | #import "CommonUtils.h" 11 | #import "PHDataHelper.h" 12 | #import "ApiManager.h" 13 | #import "ApiConfig.h" 14 | #import "ItemData.h" 15 | 16 | @implementation UserData 17 | 18 | - (void)encodeWithCoder:(NSCoder *)encoder { 19 | //Encode properties, other class variables, etc 20 | [encoder encodeObject:[NSNumber numberWithInteger:self.id] forKey:@"id"]; 21 | [encoder encodeObject:self.name forKey:@"name"]; 22 | [encoder encodeObject:self.username forKey:@"username"]; 23 | [encoder encodeObject:self.email forKey:@"email"]; 24 | [encoder encodeObject:self.photo forKey:@"photo"]; 25 | [encoder encodeObject:self.birthday forKey:@"birthday"]; 26 | [encoder encodeObject:[NSNumber numberWithInteger:self.gender] forKey:@"gender"]; 27 | } 28 | 29 | - (id)initWithCoder:(NSCoder *)decoder { 30 | 31 | if((self = [super init])) { 32 | //decode properties, other class vars 33 | self.id = [[decoder decodeObjectForKey:@"id"] integerValue]; 34 | self.name = [decoder decodeObjectForKey:@"name"]; 35 | self.username = [decoder decodeObjectForKey:@"username"]; 36 | self.email = [decoder decodeObjectForKey:@"email"]; 37 | self.photo = [decoder decodeObjectForKey:@"photo"]; 38 | self.birthday = [decoder decodeObjectForKey:@"birthday"]; 39 | self.gender = [[decoder decodeObjectForKey:@"gender"] integerValue]; 40 | 41 | self.auctionItems = [[NSMutableArray alloc] init]; 42 | self.bidItems = [[NSMutableArray alloc] init]; 43 | } 44 | 45 | return self; 46 | } 47 | 48 | - (id)initWithDic:(NSDictionary *)data { 49 | self = [super init]; 50 | 51 | if (self) { 52 | self.id = [[data valueForKey:@"id"] integerValue]; 53 | 54 | [self updateEmail:data]; 55 | [self updateProfile:data]; 56 | 57 | self.auctionItems = [[NSMutableArray alloc] init]; 58 | self.bidItems = [[NSMutableArray alloc] init]; 59 | } 60 | 61 | return self; 62 | } 63 | 64 | - (void)updateProfile:(NSDictionary *)data { 65 | self.name = [data valueForKey:@"name"]; 66 | self.username = [data valueForKey:@"username"]; 67 | self.photo = [data valueForKey:@"photo"]; 68 | 69 | // set date 70 | NSString *strDate = [data valueForKey:@"birthday"]; 71 | if (strDate) { 72 | self.birthday = [PHDataHelper stringToDate:strDate format:@"yyyy-MM-dd"]; 73 | } 74 | 75 | self.gender = [[data valueForKey:@"gender"] integerValue]; 76 | } 77 | 78 | - (void)updateEmail:(NSDictionary *)data { 79 | self.email = [data valueForKey:@"email"]; 80 | } 81 | 82 | + (void)setCurrentUser:(UserData *)user { 83 | CommonUtils *utils = [CommonUtils sharedObject]; 84 | utils.mCurrentUser = user; 85 | 86 | if (user) { 87 | // save to NSUserDefault 88 | [user saveToUserDefault]; 89 | } 90 | } 91 | 92 | + (UserData *)currentUser { 93 | CommonUtils *utils = [CommonUtils sharedObject]; 94 | UserData *data = utils.mCurrentUser; 95 | 96 | if (!data) { 97 | // try to load from NSUserDefault 98 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 99 | 100 | NSData *encodedObject = [defaults objectForKey:kCurrentUser]; 101 | if (encodedObject) { 102 | data = [NSKeyedUnarchiver unarchiveObjectWithData:encodedObject]; 103 | 104 | utils.mCurrentUser = data; 105 | } 106 | } 107 | 108 | return data; 109 | } 110 | 111 | - (void)saveToUserDefault { 112 | NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:self]; 113 | 114 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 115 | 116 | [defaults setObject:encodedObject forKey:kCurrentUser]; 117 | [defaults synchronize]; 118 | } 119 | 120 | /** 121 | get url of photo 122 | @return url 123 | */ 124 | - (NSString *)photoUrl { 125 | return [NSString stringWithFormat:@"%@%@", PH_API_BASE_USER_FILE_URL, self.photo]; 126 | } 127 | 128 | - (void)fetchAuctionItems:(NSArray *)aryDic { 129 | // clear data 130 | [self.auctionItems removeAllObjects]; 131 | 132 | for (NSDictionary *dicItem in aryDic) { 133 | ItemData *iData = [[ItemData alloc] initWithDic:dicItem]; 134 | [self.auctionItems addObject:iData]; 135 | } 136 | } 137 | 138 | - (void)fetchBidItems:(NSArray *)aryDic { 139 | // clear data 140 | [self.bidItems removeAllObjects]; 141 | 142 | for (NSDictionary *dicItem in aryDic) { 143 | ItemData *iData = [[ItemData alloc] initWithDic:dicItem]; 144 | [self.bidItems addObject:iData]; 145 | } 146 | } 147 | 148 | @end 149 | --------------------------------------------------------------------------------