├── .gitignore ├── EYPopupView ├── EYInputPopupView.h ├── EYInputPopupView.m ├── EYPopupView.bundle │ ├── EYPopupViewHeader.h │ ├── btn_close_normal.png │ ├── btn_close_normal@2x.png │ ├── btn_close_normal@3x.png │ ├── btn_close_selected.png │ ├── btn_close_selected@2x.png │ └── btn_close_selected@3x.png ├── EYPopupView.h ├── EYPopupView.m ├── EYPopupViewHeader.h ├── EYPopupViewMacro.h ├── EYTagPopupView.h ├── EYTagPopupView.m ├── EYTextPopupView.h └── EYTextPopupView.m ├── EYPopupView_Example ├── EYPopupView_Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── EYPopupView_Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ └── Localizable.strings │ ├── main.m │ └── zh-Hans.lproj │ │ ├── LaunchScreen.strings │ │ ├── Localizable.strings │ │ └── Main.strings └── EYPopupView_ExampleTests │ ├── EYPopupView_ExampleTests.m │ └── Info.plist ├── EYTagView └── EYTagView │ ├── EYTagView.h │ ├── EYTagView.m │ ├── EYTextField.h │ └── EYTextField.m ├── README.MD └── screenshots ├── checkbox.gif ├── eng-text.png ├── eng_tag.png ├── multi-line-display.gif ├── multi-lines-input.gif ├── radio.gif ├── single-line-display.gif ├── single-line-edit.gif └── tag_edit.gif /.gitignore: -------------------------------------------------------------------------------- 1 | tuangou.xcworkspace/xcuserdata/* 2 | *Breakpoints* 3 | ompiled source # 4 | ################### 5 | *.com 6 | *.class 7 | *.dll 8 | *.exe 9 | *.o 10 | *.so 11 | 12 | # Packages # 13 | ############ 14 | # it's better to unpack these files and commit the raw source 15 | # git has its own built in compression methods 16 | *.7z 17 | *.dmg 18 | *.gz 19 | *.iso 20 | *.jar 21 | *.rar 22 | *.tar 23 | *.zip 24 | 25 | # Logs and databases # 26 | ###################### 27 | *.log 28 | *.sql 29 | *.sqlite 30 | 31 | # OS generated files # 32 | ###################### 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | Icon? 39 | ehthumbs.db 40 | Thumbs.db 41 | 42 | /build/ 43 | *.dat 44 | UserInterfaceState.xcuserstate 45 | xcuserdata/ 46 | Pods/Pods.xcodeproj/xcuserdata/ 47 | /EYTagView/* 48 | !/EYTagView/EYTagView 49 | -------------------------------------------------------------------------------- /EYPopupView/EYInputPopupView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYInputPopupView.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYPopupView.h" 10 | 11 | /** 12 | 13 | */ 14 | 15 | typedef void (^clickBlock)(UIView* view, NSString* text); 16 | @interface EYInputPopupView : EYPopupView 17 | 18 | + (void)popViewWithTitle:(NSString *)title 19 | contentText:(NSString *)content 20 | type:(EYInputPopupView_Type)type 21 | cancelBlock:(dispatch_block_t)cancelBlock 22 | confirmBlock:(clickBlock)confirmBlock 23 | dismissBlock:(dispatch_block_t)dismissBlock; 24 | @end 25 | -------------------------------------------------------------------------------- /EYPopupView/EYInputPopupView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYInputPopupView.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYInputPopupView.h" 10 | #import "EYPopupViewMacro.h" 11 | #import "EYTextField.h" 12 | 13 | #define CONTENT_VIEW_POPVIEW ((popView.type==EYInputPopupView_Type_single_line_text)?popView.tfContent:popView.tvContent) 14 | #define CONTENT_VIEW ((_type==EYInputPopupView_Type_single_line_text)?_tfContent:_tvContent) 15 | #define CONTENT_TEXT ((_type==EYInputPopupView_Type_single_line_text)?_tfContent.text:_tvContent.text) 16 | 17 | 18 | @interface EYInputPopupView () 19 | 20 | 21 | @property (nonatomic) BOOL leftLeave; 22 | @property (nonatomic) EYInputPopupView_Type type; 23 | @property (nonatomic, strong) UILabel *lbTitle; 24 | @property (nonatomic, strong) UITextView *tvContent; 25 | @property (nonatomic, strong) UITextField *tfContent; 26 | @property (nonatomic, strong) UIButton *leftBtn; 27 | @property (nonatomic, strong) UIButton *rightBtn; 28 | @property (nonatomic, strong) UIView *backImageView; 29 | 30 | 31 | @property (nonatomic, copy) dispatch_block_t cancelBlock; 32 | //@property (nonatomic, copy) void (^confirmBlock)(UIView*, NSString*); 33 | @property (nonatomic, copy) clickBlock confirmBlock; 34 | @property (nonatomic, copy) dispatch_block_t dismissBlock; 35 | 36 | @end 37 | 38 | 39 | @implementation EYInputPopupView 40 | 41 | 42 | + (void)popViewWithTitle:(NSString *)title 43 | contentText:(NSString *)content 44 | type:(EYInputPopupView_Type)type 45 | cancelBlock:(dispatch_block_t)cancelBlock 46 | confirmBlock:(clickBlock)confirmBlock 47 | dismissBlock:(dispatch_block_t)dismissBlock 48 | { 49 | EYInputPopupView* popView=[EYInputPopupView new]; 50 | 51 | popView.type=type; 52 | popView.cancelBlock=cancelBlock; 53 | popView.confirmBlock=confirmBlock; 54 | popView.dismissBlock=dismissBlock; 55 | 56 | popView.layer.cornerRadius = 5.0; 57 | popView.backgroundColor = [UIColor whiteColor]; 58 | popView.lbTitle = [[UILabel alloc] initWithFrame:CGRectMake((kAlertWidth - kTitleWidth) * 0.5, kTitleTopMargin, kTitleWidth, kTitleHeight)]; 59 | popView.lbTitle.font = [UIFont boldSystemFontOfSize:20.0f]; 60 | popView.lbTitle.textColor = [UIColor colorWithRed:56.0/255.0 green:64.0/255.0 blue:71.0/255.0 alpha:1]; 61 | popView.lbTitle.textAlignment=NSTextAlignmentCenter; 62 | popView.lbTitle.backgroundColor=[UIColor clearColor]; 63 | [popView addSubview:popView.lbTitle]; 64 | popView.lbTitle.text = title; 65 | switch (type) { 66 | case EYInputPopupView_Type_single_line_text: 67 | { 68 | popView.tfContent = [[EYTextField alloc] initWithFrame:CGRectMake((kAlertWidth - kContentWidth) * 0.5, CGRectGetMaxY(popView.lbTitle.frame)+kContentTopMargin, kContentWidth, kContentMinHeight)]; 69 | popView.tfContent.delegate=popView; 70 | popView.tfContent.layer.cornerRadius=3; 71 | popView.tfContent.layer.borderColor=COLORRGB(0xaeeeeee).CGColor; 72 | popView.tfContent.layer.borderWidth=0.5; 73 | popView.tfContent.textAlignment = NSTextAlignmentLeft; 74 | popView.tfContent.textColor = [UIColor colorWithRed:127.0/255.0 green:127.0/255.0 blue:127.0/255.0 alpha:1]; 75 | popView.tfContent.font = [UIFont systemFontOfSize:15.0f]; 76 | popView.tfContent.backgroundColor=[UIColor clearColor]; 77 | [popView addSubview:popView.tfContent]; 78 | popView.tfContent.text = content; 79 | } 80 | break; 81 | case EYInputPopupView_Type_multi_line: 82 | { 83 | popView.tvContent = [[UITextView alloc] initWithFrame:CGRectMake((kAlertWidth - kContentWidth) * 0.5, CGRectGetMaxY(popView.lbTitle.frame)+kContentTopMargin, kContentWidth, kContentMinHeight)]; 84 | popView.tvContent.editable=YES; 85 | popView.tvContent.layer.cornerRadius=3; 86 | popView.tvContent.layer.borderColor=COLORRGB(0xaeeeeee).CGColor; 87 | popView.tvContent.layer.borderWidth=0.5; 88 | popView.tvContent.delegate=popView;; 89 | popView.tvContent.selectable=YES; 90 | popView.tvContent.textAlignment = NSTextAlignmentLeft; 91 | popView.tvContent.textColor = [UIColor colorWithRed:127.0/255.0 green:127.0/255.0 blue:127.0/255.0 alpha:1]; 92 | popView.tvContent.font = [UIFont systemFontOfSize:15.0f]; 93 | popView.tvContent.backgroundColor=[UIColor clearColor]; 94 | [popView addSubview:popView.tvContent]; 95 | popView.tvContent.text = content; 96 | } 97 | break; 98 | 99 | default: 100 | break; 101 | } 102 | 103 | CGRect leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin-5) * 0.5, CGRectGetMaxY(CONTENT_VIEW_POPVIEW.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 104 | CGRect rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin+5, CGRectGetMaxY(CONTENT_VIEW_POPVIEW.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 105 | popView.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 106 | popView.rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 107 | popView.leftBtn.frame = leftBtnFrame; 108 | popView.rightBtn.frame = rightBtnFrame; 109 | 110 | 111 | [popView.rightBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0xfca2a5)] forState:UIControlStateNormal]; 112 | [popView.leftBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0x90d3fe)] forState:UIControlStateNormal]; 113 | [popView.rightBtn setTitle:EYLOCALSTRING(@"OK") forState:UIControlStateNormal]; 114 | [popView.leftBtn setTitle:EYLOCALSTRING(@"Cancel") forState:UIControlStateNormal]; 115 | popView.leftBtn.titleLabel.font = popView.rightBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; 116 | [popView.leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 117 | [popView.rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 118 | 119 | [popView.leftBtn addTarget:popView action:@selector(leftBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 120 | [popView.rightBtn addTarget:popView action:@selector(rightBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 121 | popView.leftBtn.layer.masksToBounds = popView.rightBtn.layer.masksToBounds = YES; 122 | popView.leftBtn.layer.cornerRadius = popView.rightBtn.layer.cornerRadius = 3.0; 123 | [popView addSubview:popView.leftBtn]; 124 | [popView addSubview:popView.rightBtn]; 125 | 126 | UIButton *xButton = [UIButton buttonWithType:UIButtonTypeCustom]; 127 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_normal.png"] forState:UIControlStateNormal]; 128 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_selected.png"] forState:UIControlStateHighlighted]; 129 | xButton.frame = CGRectMake(kAlertWidth - 32, 0, 32, 32); 130 | [popView addSubview:xButton]; 131 | [xButton addTarget:popView action:@selector(dismissAlert) forControlEvents:UIControlEventTouchUpInside]; 132 | 133 | [popView resetFrame]; 134 | [popView show]; 135 | 136 | } 137 | 138 | - (void)leftBtnClicked:(id)sender 139 | { 140 | _leftLeave = YES; 141 | [self dismissAlert]; 142 | if (self.cancelBlock) { 143 | self.cancelBlock(); 144 | } 145 | } 146 | 147 | - (void)rightBtnClicked:(id)sender 148 | { 149 | _leftLeave = NO; 150 | [self dismissAlert]; 151 | if (self.confirmBlock) { 152 | self.confirmBlock(self,CONTENT_TEXT); 153 | } 154 | } 155 | 156 | - (void)show 157 | { 158 | UIViewController *topVC = [self appRootViewController]; 159 | self.frame=CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 160 | -self.frame.origin.y-30, 161 | self.frame.size.width, 162 | self.frame.size.height); 163 | 164 | [topVC.view addSubview:self]; 165 | } 166 | 167 | - (void)dismissAlert 168 | { 169 | [self removeFromSuperview]; 170 | if (self.dismissBlock) { 171 | self.dismissBlock(); 172 | } 173 | } 174 | 175 | - (UIViewController *)appRootViewController 176 | { 177 | UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController; 178 | UIViewController *topVC = appRootVC; 179 | while (topVC.presentedViewController) { 180 | topVC = topVC.presentedViewController; 181 | } 182 | return topVC; 183 | } 184 | 185 | 186 | - (void)removeFromSuperview 187 | { 188 | [self.backImageView removeFromSuperview]; 189 | self.backImageView = nil; 190 | UIViewController *topVC = [self appRootViewController]; 191 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 192 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 193 | CGRectGetHeight(topVC.view.bounds), 194 | self.frame.size.width, 195 | self.frame.size.height); 196 | if (_leftLeave) { 197 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 1.5); 198 | }else { 199 | self.transform = CGAffineTransformMakeRotation(M_1_PI / 1.5); 200 | } 201 | } completion:^(BOOL finished) { 202 | [super removeFromSuperview]; 203 | }]; 204 | } 205 | 206 | - (void)willMoveToSuperview:(UIView *)newSuperview 207 | { 208 | if (newSuperview == nil) { 209 | return; 210 | } 211 | UIViewController *topVC = [self appRootViewController]; 212 | 213 | if (!self.backImageView) { 214 | self.backImageView = [[UIView alloc] initWithFrame:topVC.view.bounds]; 215 | self.backImageView.backgroundColor = [UIColor blackColor]; 216 | self.backImageView.alpha = 0.6f; 217 | self.backImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 218 | 219 | 220 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapPress:)]; 221 | tapGesture.numberOfTapsRequired=1; 222 | [self.backImageView addGestureRecognizer:tapGesture]; 223 | 224 | } 225 | [topVC.view addSubview:self.backImageView]; 226 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 2); 227 | 228 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 229 | self.transform = CGAffineTransformMakeRotation(0); 230 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 231 | (CGRectGetHeight(topVC.view.bounds) - self.frame.size.height) * 0.5, 232 | self.frame.size.width, 233 | self.frame.size.height); 234 | } completion:^(BOOL finished) { 235 | }]; 236 | [super willMoveToSuperview:newSuperview]; 237 | } 238 | 239 | #pragma mark UITapGestureRecognizer 240 | -(void)handleTapPress:(UITapGestureRecognizer *)gestureRecognizer 241 | { 242 | 243 | switch (_type) { 244 | case EYInputPopupView_Type_single_line_text: 245 | { 246 | if (_tfContent.isFirstResponder) { 247 | [_tfContent resignFirstResponder]; 248 | } else { 249 | _leftLeave = YES; 250 | [self dismissAlert]; 251 | } 252 | } 253 | break; 254 | case EYInputPopupView_Type_multi_line: 255 | { 256 | if (_tvContent.isFirstResponder) { 257 | [_tvContent resignFirstResponder]; 258 | } else { 259 | _leftLeave = YES; 260 | [self dismissAlert]; 261 | } 262 | } 263 | break; 264 | 265 | default: 266 | break; 267 | } 268 | 269 | } 270 | #pragma mark - 271 | -(void)resetFrame{ 272 | 273 | 274 | switch (_type) { 275 | case EYInputPopupView_Type_single_line_text: 276 | { 277 | CGRect frame=self.frame; 278 | frame.size.height=kTitleTopMargin+kTitleHeight+kContentTopMargin+kContentBottomMargin+kButtonHeight+kButtonBottomMargin 279 | +self.tfContent.frame.size.height; 280 | frame.size.width=kAlertWidth; 281 | self.frame=frame; 282 | } 283 | break; 284 | case EYInputPopupView_Type_multi_line: 285 | { 286 | CGSize labelSize = [self.tvContent sizeThatFits:CGSizeMake(kContentWidth, 1000)]; 287 | { 288 | CGRect frame=self.tvContent.frame; 289 | frame.size.height=MAX(labelSize.height, kContentMinHeight); 290 | frame.size.height=MIN(labelSize.height, kContentMaxHeight); 291 | self.tvContent.frame=frame; 292 | self.tvContent.scrollEnabled=(self.tvContent.frame.size.height==kContentMaxHeight); 293 | } 294 | { 295 | CGRect leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin) * 0.5, CGRectGetMaxY(self.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 296 | CGRect rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin, CGRectGetMaxY(self.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 297 | self.leftBtn.frame = leftBtnFrame; 298 | self.rightBtn.frame = rightBtnFrame; 299 | } 300 | { 301 | CGRect frame=self.frame; 302 | frame.size.height=kTitleTopMargin+kTitleHeight+kContentTopMargin+kContentBottomMargin+kButtonHeight+kButtonBottomMargin 303 | +self.tvContent.frame.size.height; 304 | frame.size.width=kAlertWidth; 305 | self.frame=frame; 306 | } 307 | } 308 | break; 309 | 310 | default: 311 | break; 312 | } 313 | 314 | 315 | } 316 | #pragma mark UITextView & 317 | -(void)textFieldDidBeginEditing:(UITextField *)textField{ 318 | [self slipView:YES offset:80]; 319 | } 320 | -(void)textFieldDidEndEditing:(UITextField *)textField{ 321 | [self slipView:NO offset:0]; 322 | } 323 | -(void)textViewDidChange:(UITextView *)textView{ 324 | [self resetFrame]; 325 | } 326 | -(void)textViewDidBeginEditing:(UITextView *)textView{ 327 | [self slipView:YES offset:30]; 328 | } 329 | 330 | -(void)textViewDidEndEditing:(UITextView *)textView{ 331 | [self slipView:NO offset:0]; 332 | } 333 | 334 | -(void)slipView:(BOOL)isUp offset:(float)offset{ 335 | UIViewController *topVC = [self appRootViewController]; 336 | if (isUp) { 337 | [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 338 | self.transform = CGAffineTransformMakeRotation(0); 339 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 340 | topVC.view.bounds.origin.y+offset, 341 | self.frame.size.width, 342 | self.frame.size.height); 343 | } completion:^(BOOL finished) { 344 | }]; 345 | } else { 346 | [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 347 | self.transform = CGAffineTransformMakeRotation(0); 348 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 349 | (CGRectGetHeight(topVC.view.bounds) - self.frame.size.height) * 0.5, 350 | self.frame.size.width, 351 | self.frame.size.height); 352 | } completion:^(BOOL finished) { 353 | }]; 354 | } 355 | 356 | } 357 | 358 | @end 359 | -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/EYPopupViewHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupViewHeader.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #ifndef EYPopupView_Example_EYPopupViewHeader_h 10 | #define EYPopupView_Example_EYPopupViewHeader_h 11 | 12 | #import "EYPopupView.h" 13 | #import "EYTextPopupView.h" 14 | #import "EYInputPopupView.h" 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_normal.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_normal@2x.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_normal@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_normal@3x.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_selected.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_selected@2x.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.bundle/btn_close_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/EYPopupView/EYPopupView.bundle/btn_close_selected@3x.png -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupView.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | typedef enum{ 14 | EYInputPopupView_Type_single_line_text, 15 | EYInputPopupView_Type_multi_line, 16 | }EYInputPopupView_Type; 17 | 18 | @interface EYPopupView : UIView 19 | 20 | @end 21 | @interface UIImage (colorful) 22 | 23 | + (UIImage *)imageWithColor:(UIColor *)color; 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /EYPopupView/EYPopupView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupView.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYPopupView.h" 10 | 11 | @implementation EYPopupView 12 | 13 | 14 | @end 15 | 16 | @implementation UIImage (colorful) 17 | 18 | + (UIImage *)imageWithColor:(UIColor *)color 19 | { 20 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 21 | UIGraphicsBeginImageContext(rect.size); 22 | CGContextRef context = UIGraphicsGetCurrentContext(); 23 | 24 | CGContextSetFillColorWithColor(context, [color CGColor]); 25 | CGContextFillRect(context, rect); 26 | 27 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 28 | UIGraphicsEndImageContext(); 29 | 30 | return image; 31 | } 32 | @end -------------------------------------------------------------------------------- /EYPopupView/EYPopupViewHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupViewHeader.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #ifndef EYLOCALSTRING 10 | #define EYLOCALSTRING(STR) NSLocalizedString(STR, STR) 11 | #endif 12 | 13 | #ifndef EYPopupView_Example_EYPopupViewHeader_h 14 | #define EYPopupView_Example_EYPopupViewHeader_h 15 | 16 | 17 | typedef enum{ 18 | EYTagPopupView_Type_Edit, 19 | EYTagPopupView_Type_Display, 20 | EYTagPopupView_Type_Single_Selected, 21 | EYTagPopupView_Type_Multi_Selected, 22 | }EYTagPopupView_Type; 23 | 24 | 25 | 26 | #import "EYPopupView.h" 27 | #import "EYInputPopupView.h" 28 | #import "EYTextPopupView.h" 29 | #import "EYTagPopupView.h" 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /EYPopupView/EYPopupViewMacro.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupViewMacro.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/6/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | #ifndef EYLOCALSTRING 9 | #define EYLOCALSTRING(STR) NSLocalizedString(STR, STR) 10 | #endif 11 | 12 | 13 | #ifndef EYPopupView_Example_EYPopupViewMacro_h 14 | #define EYPopupView_Example_EYPopupViewMacro_h 15 | 16 | 17 | #define COLORRGBA(c,a) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 18 | green:((c>>8)&0xFF)/255.0 \ 19 | blue:(c&0xFF)/255.0 \ 20 | alpha:a] 21 | #define COLORRGB(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 22 | green:((c>>8)&0xFF)/255.0 \ 23 | blue:(c&0xFF)/255.0 \ 24 | alpha:1.0] 25 | 26 | 27 | 28 | #define _K_SCREEN_WIDTH ([[UIScreen mainScreen ] bounds ].size.width) 29 | 30 | #define kAlertWidth (245 * _K_SCREEN_WIDTH/320) 31 | #define kTitleWidth (kAlertWidth-16-32) 32 | #define kContentWidth (kAlertWidth-16) 33 | 34 | #define kContentMaxHeight 150.0f 35 | #define kContentMinHeight 34.0f 36 | 37 | #define kTitleTopMargin 15.0f 38 | #define kTitleHeight 25.0f 39 | 40 | #define kSingleButtonWidth (160.0f * _K_SCREEN_WIDTH/320) 41 | #define kCoupleButtonWidth (107.0f * _K_SCREEN_WIDTH/320) 42 | #define kButtonHeight 40.0f 43 | #define kButtonBottomMargin 10.0f 44 | 45 | #define kContentBottomMargin 12.0f 46 | #define kContentTopMargin 6.0f 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /EYPopupView/EYTagPopupView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagPopupView.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYPopupView.h" 10 | #import "EYPopupViewHeader.h" 11 | /** 12 | 13 | */ 14 | 15 | typedef void (^arrayClickBlock)(UIView* view, NSArray* tags); 16 | @interface EYTagPopupView : EYPopupView 17 | 18 | 19 | + (void)popViewWithTitle:(NSString *)title 20 | tags:(NSArray *)tags 21 | type:(EYTagPopupView_Type)type 22 | cancelBlock:(dispatch_block_t)cancelBlock 23 | confirmBlock:(arrayClickBlock)confirmBlock 24 | dismissBlock:(dispatch_block_t)dismissBlock; 25 | + (void)popViewWithTitle:(NSString *)title 26 | tags:(NSArray *)tags 27 | selectTags:(NSArray *)selectTags 28 | type:(EYTagPopupView_Type)type 29 | cancelBlock:(dispatch_block_t)cancelBlock 30 | confirmBlock:(arrayClickBlock)confirmBlock 31 | dismissBlock:(dispatch_block_t)dismissBlock; 32 | @end 33 | -------------------------------------------------------------------------------- /EYPopupView/EYTagPopupView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagPopupView.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYTagPopupView.h" 10 | #import "EYPopupViewMacro.h" 11 | #import "EYTagView.h" 12 | 13 | 14 | 15 | @interface EYTagPopupView () 16 | 17 | 18 | @property (nonatomic) BOOL leftLeave; 19 | @property (nonatomic, strong) UILabel *lbTitle; 20 | @property (nonatomic, strong) EYTagView* tagView; 21 | @property (nonatomic, strong) UIButton *leftBtn; 22 | @property (nonatomic, strong) UIButton *rightBtn; 23 | @property (nonatomic, strong) UIView *backImageView; 24 | 25 | 26 | @property (nonatomic, copy) dispatch_block_t cancelBlock; 27 | @property (nonatomic, copy) arrayClickBlock confirmBlock; 28 | @property (nonatomic, copy) dispatch_block_t dismissBlock; 29 | 30 | @end 31 | 32 | 33 | @implementation EYTagPopupView 34 | 35 | 36 | 37 | + (void)popViewWithTitle:(NSString *)title 38 | tags:(NSArray *)tags 39 | type:(EYTagPopupView_Type)type 40 | cancelBlock:(dispatch_block_t)cancelBlock 41 | confirmBlock:(arrayClickBlock)confirmBlock 42 | dismissBlock:(dispatch_block_t)dismissBlock 43 | { 44 | [self popViewWithTitle:title tags:tags selectTags:nil type:type cancelBlock:cancelBlock confirmBlock:confirmBlock dismissBlock:dismissBlock]; 45 | 46 | } 47 | + (void)popViewWithTitle:(NSString *)title 48 | tags:(NSArray *)tags 49 | selectTags:(NSArray *)selectTags 50 | type:(EYTagPopupView_Type)type 51 | cancelBlock:(dispatch_block_t)cancelBlock 52 | confirmBlock:(arrayClickBlock)confirmBlock 53 | dismissBlock:(dispatch_block_t)dismissBlock 54 | { 55 | 56 | EYTagPopupView* popView=[EYTagPopupView new]; 57 | popView.cancelBlock=cancelBlock; 58 | popView.confirmBlock=confirmBlock; 59 | popView.dismissBlock=dismissBlock; 60 | 61 | popView.layer.cornerRadius = 5.0; 62 | popView.backgroundColor = [UIColor whiteColor]; 63 | popView.lbTitle = [[UILabel alloc] initWithFrame:CGRectMake((kAlertWidth - kTitleWidth) * 0.5, kTitleTopMargin, kTitleWidth, kTitleHeight)]; 64 | popView.lbTitle.font = [UIFont boldSystemFontOfSize:20.0f]; 65 | popView.lbTitle.textColor = [UIColor colorWithRed:56.0/255.0 green:64.0/255.0 blue:71.0/255.0 alpha:1]; 66 | popView.lbTitle.textAlignment=NSTextAlignmentCenter; 67 | popView.lbTitle.backgroundColor=[UIColor clearColor]; 68 | [popView addSubview:popView.lbTitle]; 69 | popView.lbTitle.text = title; 70 | 71 | 72 | { 73 | EYTagView* tagView=[[EYTagView alloc]initWithFrame:CGRectMake((kAlertWidth - kContentWidth) * 0.5, CGRectGetMaxY(popView.lbTitle.frame)+kContentTopMargin, kContentWidth, kContentMinHeight)]; 74 | tagView.delegate=popView; 75 | 76 | tagView.colorTag=COLORRGB(0xffffff); 77 | tagView.colorTagBg=COLORRGB(0xfcbf90); 78 | tagView.colorInput=COLORRGB(0xfcbf90); 79 | tagView.colorInputBg=COLORRGB(0xffffff); 80 | tagView.colorInputPlaceholder=COLORRGB(0xfcbf90); 81 | tagView.backgroundColor=COLORRGB(0xffffff); 82 | tagView.colorInputBoard=COLORRGB(0xfcbf90); 83 | tagView.viewMaxHeight=kContentMaxHeight; 84 | tagView.type=(EYTagView_Type)type; 85 | [tagView addTags:tags]; 86 | if (selectTags) { 87 | [tagView setTagStringsSelected:[NSMutableArray arrayWithArray:selectTags]]; 88 | } 89 | [popView addSubview:tagView]; 90 | popView.tagView=tagView; 91 | } 92 | 93 | 94 | 95 | 96 | CGRect leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin) * 0.5, CGRectGetMaxY(popView.tagView.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 97 | CGRect rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin, CGRectGetMaxY(popView.tagView.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 98 | popView.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 99 | popView.rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 100 | popView.leftBtn.frame = leftBtnFrame; 101 | popView.rightBtn.frame = rightBtnFrame; 102 | 103 | 104 | [popView.rightBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0xfca2a5)] forState:UIControlStateNormal]; 105 | [popView.leftBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0x90d3fe)] forState:UIControlStateNormal]; 106 | [popView.rightBtn setTitle:EYLOCALSTRING(@"OK") forState:UIControlStateNormal]; 107 | [popView.leftBtn setTitle:EYLOCALSTRING(@"Cancel") forState:UIControlStateNormal]; 108 | popView.leftBtn.titleLabel.font = popView.rightBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; 109 | [popView.leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 110 | [popView.rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 111 | 112 | [popView.leftBtn addTarget:popView action:@selector(leftBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 113 | [popView.rightBtn addTarget:popView action:@selector(rightBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 114 | popView.leftBtn.layer.masksToBounds = popView.rightBtn.layer.masksToBounds = YES; 115 | popView.leftBtn.layer.cornerRadius = popView.rightBtn.layer.cornerRadius = 3.0; 116 | [popView addSubview:popView.leftBtn]; 117 | [popView addSubview:popView.rightBtn]; 118 | 119 | UIButton *xButton = [UIButton buttonWithType:UIButtonTypeCustom]; 120 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_normal.png"] forState:UIControlStateNormal]; 121 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_selected.png"] forState:UIControlStateHighlighted]; 122 | xButton.frame = CGRectMake(kAlertWidth - 32, 0, 32, 32); 123 | [popView addSubview:xButton]; 124 | [xButton addTarget:popView action:@selector(dismissAlert) forControlEvents:UIControlEventTouchUpInside]; 125 | 126 | [popView resetFrame]; 127 | [popView show]; 128 | 129 | } 130 | 131 | - (void)leftBtnClicked:(id)sender 132 | { 133 | _leftLeave = YES; 134 | [self dismissAlert]; 135 | if (self.cancelBlock) { 136 | self.cancelBlock(); 137 | } 138 | } 139 | 140 | - (void)rightBtnClicked:(id)sender 141 | { 142 | _leftLeave = NO; 143 | [self dismissAlert]; 144 | if (self.confirmBlock) { 145 | self.confirmBlock(self,_tagView.tagStrings); 146 | } 147 | } 148 | 149 | - (void)show 150 | { 151 | UIViewController *topVC = [self appRootViewController]; 152 | self.frame=CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 153 | -self.frame.origin.y-30, 154 | self.frame.size.width, 155 | self.frame.size.height); 156 | 157 | [topVC.view addSubview:self]; 158 | } 159 | 160 | - (void)dismissAlert 161 | { 162 | [self removeFromSuperview]; 163 | if (self.dismissBlock) { 164 | self.dismissBlock(); 165 | } 166 | } 167 | 168 | - (UIViewController *)appRootViewController 169 | { 170 | UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController; 171 | UIViewController *topVC = appRootVC; 172 | while (topVC.presentedViewController) { 173 | topVC = topVC.presentedViewController; 174 | } 175 | return topVC; 176 | } 177 | 178 | 179 | - (void)removeFromSuperview 180 | { 181 | [self.backImageView removeFromSuperview]; 182 | self.backImageView = nil; 183 | UIViewController *topVC = [self appRootViewController]; 184 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 185 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 186 | CGRectGetHeight(topVC.view.bounds), 187 | self.frame.size.width, 188 | self.frame.size.height); 189 | if (_leftLeave) { 190 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 1.5); 191 | }else { 192 | self.transform = CGAffineTransformMakeRotation(M_1_PI / 1.5); 193 | } 194 | } completion:^(BOOL finished) { 195 | [super removeFromSuperview]; 196 | }]; 197 | } 198 | 199 | - (void)willMoveToSuperview:(UIView *)newSuperview 200 | { 201 | if (newSuperview == nil) { 202 | return; 203 | } 204 | UIViewController *topVC = [self appRootViewController]; 205 | 206 | if (!self.backImageView) { 207 | self.backImageView = [[UIView alloc] initWithFrame:topVC.view.bounds]; 208 | self.backImageView.backgroundColor = [UIColor blackColor]; 209 | self.backImageView.alpha = 0.6f; 210 | self.backImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 211 | 212 | 213 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapPress:)]; 214 | tapGesture.numberOfTapsRequired=1; 215 | [self.backImageView addGestureRecognizer:tapGesture]; 216 | 217 | } 218 | [topVC.view addSubview:self.backImageView]; 219 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 2); 220 | 221 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 222 | self.transform = CGAffineTransformMakeRotation(0); 223 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 224 | (CGRectGetHeight(topVC.view.bounds) - self.frame.size.height) * 0.5, 225 | self.frame.size.width, 226 | self.frame.size.height); 227 | } completion:^(BOOL finished) { 228 | }]; 229 | [super willMoveToSuperview:newSuperview]; 230 | } 231 | 232 | #pragma mark UITapGestureRecognizer 233 | -(void)handleTapPress:(UITapGestureRecognizer *)gestureRecognizer 234 | { 235 | 236 | if (self.tagView.tfInput.isFirstResponder) { 237 | [self.tagView.tfInput resignFirstResponder]; 238 | } else { 239 | _leftLeave = YES; 240 | [self dismissAlert]; 241 | } 242 | 243 | } 244 | #pragma mark - 245 | -(void)resetFrame{ 246 | { 247 | CGRect leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin) * 0.5, CGRectGetMaxY(self.tagView.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 248 | CGRect rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin, CGRectGetMaxY(self.tagView.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 249 | self.leftBtn.frame = leftBtnFrame; 250 | self.rightBtn.frame = rightBtnFrame; 251 | } 252 | { 253 | CGRect frame=self.frame; 254 | frame.size.height=kTitleTopMargin+kTitleHeight+kContentTopMargin+kContentBottomMargin+kButtonHeight+kButtonBottomMargin 255 | +self.tagView.frame.size.height; 256 | frame.size.width=kAlertWidth; 257 | self.frame=frame; 258 | } 259 | } 260 | #pragma mark UITextView & 261 | -(void)heightDidChangedTagView:(EYTagView *)tagView{ 262 | [self resetFrame]; 263 | } 264 | -(void)textFieldDidEndEditing:(UITextField *)textField{ 265 | [self slipView:NO offset:60]; 266 | } 267 | -(void)textFieldDidBeginEditing:(UITextField *)textField{ 268 | [self slipView:YES offset:60]; 269 | } 270 | 271 | -(void)slipView:(BOOL)isUp offset:(float)offset{ 272 | UIViewController *topVC = [self appRootViewController]; 273 | if (isUp) { 274 | [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 275 | self.transform = CGAffineTransformMakeRotation(0); 276 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 277 | topVC.view.bounds.origin.y+offset, 278 | self.frame.size.width, 279 | self.frame.size.height); 280 | } completion:^(BOOL finished) { 281 | }]; 282 | } else { 283 | [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 284 | self.transform = CGAffineTransformMakeRotation(0); 285 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 286 | (CGRectGetHeight(topVC.view.bounds) - self.frame.size.height) * 0.5, 287 | self.frame.size.width, 288 | self.frame.size.height); 289 | } completion:^(BOOL finished) { 290 | }]; 291 | } 292 | 293 | } 294 | 295 | @end 296 | -------------------------------------------------------------------------------- /EYPopupView/EYTextPopupView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextPopupView.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYPopupView.h" 10 | 11 | 12 | @interface EYTextPopupView : EYPopupView 13 | 14 | + (void)popViewWithTitle:(NSString *)title 15 | contentText:(NSString *)content 16 | leftButtonTitle:(NSString *)leftTitle 17 | rightButtonTitle:(NSString *)rigthTitle 18 | leftBlock:(dispatch_block_t)leftBlock 19 | rightBlock:(dispatch_block_t)rightBlock 20 | dismissBlock:(dispatch_block_t)dismissBlock; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /EYPopupView/EYTextPopupView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextPopupView.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYTextPopupView.h" 10 | #import "EYPopupViewMacro.h" 11 | 12 | @interface EYTextPopupView () 13 | 14 | @property (nonatomic) BOOL leftLeave; 15 | @property (nonatomic, strong) UILabel *lbTitle; 16 | @property (nonatomic, strong) UITextView *tvContent; 17 | @property (nonatomic, strong) UIButton *leftBtn; 18 | @property (nonatomic, strong) UIButton *rightBtn; 19 | @property (nonatomic, strong) UIView *backImageView; 20 | 21 | @property (nonatomic, copy) dispatch_block_t leftBlock; 22 | @property (nonatomic, copy) dispatch_block_t rightBlock; 23 | @property (nonatomic, copy) dispatch_block_t dismissBlock; 24 | 25 | @end 26 | 27 | 28 | @implementation EYTextPopupView{ 29 | 30 | 31 | } 32 | 33 | 34 | + (void)popViewWithTitle:(NSString *)title 35 | contentText:(NSString *)content 36 | leftButtonTitle:(NSString *)leftTitle 37 | rightButtonTitle:(NSString *)rigthTitle 38 | leftBlock:(dispatch_block_t)leftBlock 39 | rightBlock:(dispatch_block_t)rightBlock 40 | dismissBlock:(dispatch_block_t)dismissBlock 41 | { 42 | EYTextPopupView* popView=[EYTextPopupView new]; 43 | 44 | popView.leftBlock=leftBlock; 45 | popView.rightBlock=rightBlock; 46 | popView.dismissBlock=dismissBlock; 47 | 48 | popView.layer.cornerRadius = 5.0; 49 | popView.backgroundColor = [UIColor whiteColor]; 50 | popView.lbTitle = [[UILabel alloc] initWithFrame:CGRectMake((kAlertWidth - kTitleWidth) * 0.5, kTitleTopMargin, kTitleWidth, kTitleHeight)]; 51 | popView.lbTitle.font = [UIFont boldSystemFontOfSize:20.0f]; 52 | popView.lbTitle.textColor = [UIColor colorWithRed:56.0/255.0 green:64.0/255.0 blue:71.0/255.0 alpha:1]; 53 | popView.lbTitle.textAlignment=NSTextAlignmentCenter; 54 | popView.lbTitle.backgroundColor=[UIColor clearColor]; 55 | [popView addSubview:popView.lbTitle]; 56 | popView.lbTitle.text = title; 57 | 58 | popView.tvContent = [[UITextView alloc] initWithFrame:CGRectMake((kAlertWidth - kContentWidth) * 0.5, CGRectGetMaxY(popView.lbTitle.frame)+kContentTopMargin, kContentWidth, kContentMinHeight)]; 59 | popView.tvContent.editable=NO; 60 | popView.tvContent.selectable=NO; 61 | popView.tvContent.textAlignment = popView.lbTitle.textAlignment = NSTextAlignmentCenter; 62 | popView.tvContent.textColor = [UIColor colorWithRed:127.0/255.0 green:127.0/255.0 blue:127.0/255.0 alpha:1]; 63 | popView.tvContent.font = [UIFont systemFontOfSize:15.0f]; 64 | popView.tvContent.backgroundColor=[UIColor clearColor]; 65 | [popView addSubview:popView.tvContent]; 66 | popView.tvContent.text = content; 67 | 68 | 69 | CGRect leftBtnFrame; 70 | CGRect rightBtnFrame; 71 | 72 | if (!leftTitle) { 73 | rightBtnFrame = CGRectMake((kAlertWidth - kSingleButtonWidth) * 0.5, CGRectGetMaxY(popView.tvContent.frame)+kContentBottomMargin, kSingleButtonWidth, kButtonHeight); 74 | popView.rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 75 | popView.rightBtn.frame = rightBtnFrame; 76 | 77 | }else { 78 | leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin) * 0.5, CGRectGetMaxY(popView.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 79 | rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin, CGRectGetMaxY(popView.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 80 | popView.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 81 | popView.rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 82 | popView.leftBtn.frame = leftBtnFrame; 83 | popView.rightBtn.frame = rightBtnFrame; 84 | } 85 | 86 | [popView.rightBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0xfca2a5)] forState:UIControlStateNormal]; 87 | [popView.leftBtn setBackgroundImage:[UIImage imageWithColor:COLORRGB(0x90d3fe)] forState:UIControlStateNormal]; 88 | [popView.rightBtn setTitle:rigthTitle forState:UIControlStateNormal]; 89 | [popView.leftBtn setTitle:leftTitle forState:UIControlStateNormal]; 90 | popView.leftBtn.titleLabel.font = popView.rightBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; 91 | [popView.leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 92 | [popView.rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 93 | 94 | [popView.leftBtn addTarget:popView action:@selector(leftBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 95 | [popView.rightBtn addTarget:popView action:@selector(rightBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; 96 | popView.leftBtn.layer.masksToBounds = popView.rightBtn.layer.masksToBounds = YES; 97 | popView.leftBtn.layer.cornerRadius = popView.rightBtn.layer.cornerRadius = 3.0; 98 | [popView addSubview:popView.leftBtn]; 99 | [popView addSubview:popView.rightBtn]; 100 | 101 | UIButton *xButton = [UIButton buttonWithType:UIButtonTypeCustom]; 102 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_normal.png"] forState:UIControlStateNormal]; 103 | [xButton setImage:[UIImage imageNamed:@"EYPopupView.bundle/btn_close_selected.png"] forState:UIControlStateHighlighted]; 104 | xButton.frame = CGRectMake(kAlertWidth - 32, 0, 32, 32); 105 | [popView addSubview:xButton]; 106 | [xButton addTarget:popView action:@selector(dismissAlert) forControlEvents:UIControlEventTouchUpInside]; 107 | 108 | [popView resetFrame]; 109 | [popView show]; 110 | 111 | } 112 | 113 | - (void)leftBtnClicked:(id)sender 114 | { 115 | _leftLeave = YES; 116 | [self dismissAlert]; 117 | if (self.leftBlock) { 118 | self.leftBlock(); 119 | } 120 | } 121 | 122 | - (void)rightBtnClicked:(id)sender 123 | { 124 | _leftLeave = NO; 125 | [self dismissAlert]; 126 | if (self.rightBlock) { 127 | self.rightBlock(); 128 | } 129 | } 130 | 131 | - (void)show 132 | { 133 | UIViewController *topVC = [self appRootViewController]; 134 | self.frame=CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 135 | -self.frame.origin.y-30, 136 | self.frame.size.width, 137 | self.frame.size.height); 138 | 139 | [topVC.view addSubview:self]; 140 | } 141 | 142 | - (void)dismissAlert 143 | { 144 | [self removeFromSuperview]; 145 | if (self.dismissBlock) { 146 | self.dismissBlock(); 147 | } 148 | } 149 | 150 | - (UIViewController *)appRootViewController 151 | { 152 | UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController; 153 | UIViewController *topVC = appRootVC; 154 | while (topVC.presentedViewController) { 155 | topVC = topVC.presentedViewController; 156 | } 157 | return topVC; 158 | } 159 | 160 | 161 | - (void)removeFromSuperview 162 | { 163 | [self.backImageView removeFromSuperview]; 164 | self.backImageView = nil; 165 | UIViewController *topVC = [self appRootViewController]; 166 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 167 | self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 168 | CGRectGetHeight(topVC.view.bounds), 169 | self.frame.size.width, 170 | self.frame.size.height); 171 | if (_leftLeave) { 172 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 1.5); 173 | }else { 174 | self.transform = CGAffineTransformMakeRotation(M_1_PI / 1.5); 175 | } 176 | } completion:^(BOOL finished) { 177 | [super removeFromSuperview]; 178 | }]; 179 | } 180 | 181 | - (void)willMoveToSuperview:(UIView *)newSuperview 182 | { 183 | if (newSuperview == nil) { 184 | return; 185 | } 186 | UIViewController *topVC = [self appRootViewController]; 187 | 188 | if (!self.backImageView) { 189 | self.backImageView = [[UIView alloc] initWithFrame:topVC.view.bounds]; 190 | self.backImageView.backgroundColor = [UIColor blackColor]; 191 | self.backImageView.alpha = 0.6f; 192 | self.backImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 193 | 194 | 195 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapPress:)]; 196 | tapGesture.numberOfTapsRequired=1; 197 | [self.backImageView addGestureRecognizer:tapGesture]; 198 | 199 | } 200 | [topVC.view addSubview:self.backImageView]; 201 | self.transform = CGAffineTransformMakeRotation(-M_1_PI / 2); 202 | 203 | [UIView animateWithDuration:0.35f delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 204 | self.transform = CGAffineTransformMakeRotation(0); 205 | self.frame = self.frame = CGRectMake((CGRectGetWidth(topVC.view.bounds) - kAlertWidth) * 0.5, 206 | (CGRectGetHeight(topVC.view.bounds) - self.frame.size.height) * 0.5, 207 | self.frame.size.width, 208 | self.frame.size.height); 209 | } completion:^(BOOL finished) { 210 | }]; 211 | [super willMoveToSuperview:newSuperview]; 212 | } 213 | 214 | #pragma mark UITapGestureRecognizer 215 | -(void)handleTapPress:(UITapGestureRecognizer *)gestureRecognizer 216 | { 217 | _leftLeave = YES; 218 | [self dismissAlert]; 219 | } 220 | #pragma mark - 221 | -(void)resetFrame{ 222 | CGSize labelSize = [self.tvContent sizeThatFits:CGSizeMake(kContentWidth, 1000)]; 223 | { 224 | CGRect frame=self.tvContent.frame; 225 | frame.size.height=MAX(labelSize.height, kContentMinHeight); 226 | frame.size.height=MIN(labelSize.height, kContentMaxHeight); 227 | self.tvContent.frame=frame; 228 | self.tvContent.scrollEnabled=(self.tvContent.frame.size.height==kContentMaxHeight); 229 | } 230 | { 231 | CGRect leftBtnFrame = CGRectMake((kAlertWidth - 2 * kCoupleButtonWidth - kButtonBottomMargin) * 0.5, CGRectGetMaxY(self.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 232 | CGRect rightBtnFrame = CGRectMake(CGRectGetMaxX(leftBtnFrame) + kButtonBottomMargin, CGRectGetMaxY(self.tvContent.frame)+kContentBottomMargin, kCoupleButtonWidth, kButtonHeight); 233 | self.leftBtn.frame = leftBtnFrame; 234 | self.rightBtn.frame = rightBtnFrame; 235 | } 236 | { 237 | CGRect frame=self.frame; 238 | frame.size.height=kTitleTopMargin+kTitleHeight+kContentTopMargin+kContentBottomMargin+kButtonHeight+kButtonBottomMargin 239 | +self.tvContent.frame.size.height; 240 | frame.size.width=kAlertWidth; 241 | self.frame=frame; 242 | } 243 | 244 | } 245 | 246 | @end 247 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5F1F30CB1B7DEC300025120E /* EYTagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F1F30CA1B7DEC300025120E /* EYTagView.m */; }; 11 | 5F1F30CE1B7E00850025120E /* EYTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F1F30CD1B7E00850025120E /* EYTextField.m */; }; 12 | 5F3FDFA31B775B6200DE721B /* EYTagPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F3FDFA21B775B6200DE721B /* EYTagPopupView.m */; }; 13 | 5F46273F1B7219BF009695EC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F46273E1B7219BF009695EC /* main.m */; }; 14 | 5F4627421B7219BF009695EC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F4627411B7219BF009695EC /* AppDelegate.m */; }; 15 | 5F4627451B7219BF009695EC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F4627441B7219BF009695EC /* ViewController.m */; }; 16 | 5F4627481B7219BF009695EC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5F4627461B7219BF009695EC /* Main.storyboard */; }; 17 | 5F46274A1B7219BF009695EC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5F4627491B7219BF009695EC /* Images.xcassets */; }; 18 | 5F46274D1B7219BF009695EC /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F46274B1B7219BF009695EC /* LaunchScreen.xib */; }; 19 | 5F4627591B7219BF009695EC /* EYPopupView_ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F4627581B7219BF009695EC /* EYPopupView_ExampleTests.m */; }; 20 | 5F4627941B7342B8009695EC /* EYInputPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F46278C1B7342B8009695EC /* EYInputPopupView.m */; }; 21 | 5F4627951B7342B8009695EC /* EYPopupView.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 5F46278D1B7342B8009695EC /* EYPopupView.bundle */; }; 22 | 5F4627961B7342B8009695EC /* EYPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F46278F1B7342B8009695EC /* EYPopupView.m */; }; 23 | 5F4627971B7342B8009695EC /* EYTextPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F4627931B7342B8009695EC /* EYTextPopupView.m */; }; 24 | 5FE9C35C1B8F666C00868E32 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5FE9C35E1B8F666C00868E32 /* Localizable.strings */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 5F4627531B7219BF009695EC /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 5F4627311B7219BF009695EC /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 5F4627381B7219BF009695EC; 33 | remoteInfo = EYPopupView_Example; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 5F1F30C91B7DEC300025120E /* EYTagView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTagView.h; sourceTree = ""; }; 39 | 5F1F30CA1B7DEC300025120E /* EYTagView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTagView.m; sourceTree = ""; }; 40 | 5F1F30CC1B7E00850025120E /* EYTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTextField.h; sourceTree = ""; }; 41 | 5F1F30CD1B7E00850025120E /* EYTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTextField.m; sourceTree = ""; }; 42 | 5F3FDFA11B775B6200DE721B /* EYTagPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTagPopupView.h; sourceTree = ""; }; 43 | 5F3FDFA21B775B6200DE721B /* EYTagPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTagPopupView.m; sourceTree = ""; }; 44 | 5F4627391B7219BF009695EC /* EYPopupView_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EYPopupView_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 5F46273D1B7219BF009695EC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 5F46273E1B7219BF009695EC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 5F4627401B7219BF009695EC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 5F4627411B7219BF009695EC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 5F4627431B7219BF009695EC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 50 | 5F4627441B7219BF009695EC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 51 | 5F4627471B7219BF009695EC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 52 | 5F4627491B7219BF009695EC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 5F46274C1B7219BF009695EC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 54 | 5F4627521B7219BF009695EC /* EYPopupView_ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EYPopupView_ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 5F4627571B7219BF009695EC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 5F4627581B7219BF009695EC /* EYPopupView_ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EYPopupView_ExampleTests.m; sourceTree = ""; }; 57 | 5F46278B1B7342B8009695EC /* EYInputPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYInputPopupView.h; sourceTree = ""; }; 58 | 5F46278C1B7342B8009695EC /* EYInputPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYInputPopupView.m; sourceTree = ""; }; 59 | 5F46278D1B7342B8009695EC /* EYPopupView.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = EYPopupView.bundle; sourceTree = ""; }; 60 | 5F46278E1B7342B8009695EC /* EYPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYPopupView.h; sourceTree = ""; }; 61 | 5F46278F1B7342B8009695EC /* EYPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYPopupView.m; sourceTree = ""; }; 62 | 5F4627901B7342B8009695EC /* EYPopupViewHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYPopupViewHeader.h; sourceTree = ""; }; 63 | 5F4627911B7342B8009695EC /* EYPopupViewMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYPopupViewMacro.h; sourceTree = ""; }; 64 | 5F4627921B7342B8009695EC /* EYTextPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTextPopupView.h; sourceTree = ""; }; 65 | 5F4627931B7342B8009695EC /* EYTextPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTextPopupView.m; sourceTree = ""; }; 66 | 5FE9C35A1B8F665F00868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; 67 | 5FE9C35B1B8F665F00868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; 68 | 5FE9C35D1B8F666C00868E32 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 69 | 5FE9C35F1B8F666F00868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 5F4627361B7219BF009695EC /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 5F46274F1B7219BF009695EC /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 5F1F30C81B7DEC300025120E /* EYTagView */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 5F1F30C91B7DEC300025120E /* EYTagView.h */, 94 | 5F1F30CA1B7DEC300025120E /* EYTagView.m */, 95 | 5F1F30CC1B7E00850025120E /* EYTextField.h */, 96 | 5F1F30CD1B7E00850025120E /* EYTextField.m */, 97 | ); 98 | name = EYTagView; 99 | path = ../EYTagView/EYTagView; 100 | sourceTree = ""; 101 | }; 102 | 5F4627301B7219BF009695EC = { 103 | isa = PBXGroup; 104 | children = ( 105 | 5F1F30C81B7DEC300025120E /* EYTagView */, 106 | 5F46278A1B7342B8009695EC /* EYPopupView */, 107 | 5F46273B1B7219BF009695EC /* EYPopupView_Example */, 108 | 5F4627551B7219BF009695EC /* EYPopupView_ExampleTests */, 109 | 5F46273A1B7219BF009695EC /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 5F46273A1B7219BF009695EC /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 5F4627391B7219BF009695EC /* EYPopupView_Example.app */, 117 | 5F4627521B7219BF009695EC /* EYPopupView_ExampleTests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 5F46273B1B7219BF009695EC /* EYPopupView_Example */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 5F4627401B7219BF009695EC /* AppDelegate.h */, 126 | 5F4627411B7219BF009695EC /* AppDelegate.m */, 127 | 5F4627431B7219BF009695EC /* ViewController.h */, 128 | 5F4627441B7219BF009695EC /* ViewController.m */, 129 | 5F4627461B7219BF009695EC /* Main.storyboard */, 130 | 5F4627491B7219BF009695EC /* Images.xcassets */, 131 | 5F46274B1B7219BF009695EC /* LaunchScreen.xib */, 132 | 5F46273C1B7219BF009695EC /* Supporting Files */, 133 | 5FE9C35E1B8F666C00868E32 /* Localizable.strings */, 134 | ); 135 | path = EYPopupView_Example; 136 | sourceTree = ""; 137 | }; 138 | 5F46273C1B7219BF009695EC /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 5F46273D1B7219BF009695EC /* Info.plist */, 142 | 5F46273E1B7219BF009695EC /* main.m */, 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | 5F4627551B7219BF009695EC /* EYPopupView_ExampleTests */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 5F4627581B7219BF009695EC /* EYPopupView_ExampleTests.m */, 151 | 5F4627561B7219BF009695EC /* Supporting Files */, 152 | ); 153 | path = EYPopupView_ExampleTests; 154 | sourceTree = ""; 155 | }; 156 | 5F4627561B7219BF009695EC /* Supporting Files */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 5F4627571B7219BF009695EC /* Info.plist */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | 5F46278A1B7342B8009695EC /* EYPopupView */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 5F3FDFA11B775B6200DE721B /* EYTagPopupView.h */, 168 | 5F3FDFA21B775B6200DE721B /* EYTagPopupView.m */, 169 | 5F46278B1B7342B8009695EC /* EYInputPopupView.h */, 170 | 5F46278C1B7342B8009695EC /* EYInputPopupView.m */, 171 | 5F46278D1B7342B8009695EC /* EYPopupView.bundle */, 172 | 5F46278E1B7342B8009695EC /* EYPopupView.h */, 173 | 5F46278F1B7342B8009695EC /* EYPopupView.m */, 174 | 5F4627901B7342B8009695EC /* EYPopupViewHeader.h */, 175 | 5F4627911B7342B8009695EC /* EYPopupViewMacro.h */, 176 | 5F4627921B7342B8009695EC /* EYTextPopupView.h */, 177 | 5F4627931B7342B8009695EC /* EYTextPopupView.m */, 178 | ); 179 | name = EYPopupView; 180 | path = ../EYPopupView; 181 | sourceTree = ""; 182 | }; 183 | /* End PBXGroup section */ 184 | 185 | /* Begin PBXNativeTarget section */ 186 | 5F4627381B7219BF009695EC /* EYPopupView_Example */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 5F46275C1B7219BF009695EC /* Build configuration list for PBXNativeTarget "EYPopupView_Example" */; 189 | buildPhases = ( 190 | 5F4627351B7219BF009695EC /* Sources */, 191 | 5F4627361B7219BF009695EC /* Frameworks */, 192 | 5F4627371B7219BF009695EC /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | ); 198 | name = EYPopupView_Example; 199 | productName = EYPopupView_Example; 200 | productReference = 5F4627391B7219BF009695EC /* EYPopupView_Example.app */; 201 | productType = "com.apple.product-type.application"; 202 | }; 203 | 5F4627511B7219BF009695EC /* EYPopupView_ExampleTests */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = 5F46275F1B7219BF009695EC /* Build configuration list for PBXNativeTarget "EYPopupView_ExampleTests" */; 206 | buildPhases = ( 207 | 5F46274E1B7219BF009695EC /* Sources */, 208 | 5F46274F1B7219BF009695EC /* Frameworks */, 209 | 5F4627501B7219BF009695EC /* Resources */, 210 | ); 211 | buildRules = ( 212 | ); 213 | dependencies = ( 214 | 5F4627541B7219BF009695EC /* PBXTargetDependency */, 215 | ); 216 | name = EYPopupView_ExampleTests; 217 | productName = EYPopupView_ExampleTests; 218 | productReference = 5F4627521B7219BF009695EC /* EYPopupView_ExampleTests.xctest */; 219 | productType = "com.apple.product-type.bundle.unit-test"; 220 | }; 221 | /* End PBXNativeTarget section */ 222 | 223 | /* Begin PBXProject section */ 224 | 5F4627311B7219BF009695EC /* Project object */ = { 225 | isa = PBXProject; 226 | attributes = { 227 | LastUpgradeCheck = 0640; 228 | ORGANIZATIONNAME = "Eric Yang"; 229 | TargetAttributes = { 230 | 5F4627381B7219BF009695EC = { 231 | CreatedOnToolsVersion = 6.4; 232 | }; 233 | 5F4627511B7219BF009695EC = { 234 | CreatedOnToolsVersion = 6.4; 235 | TestTargetID = 5F4627381B7219BF009695EC; 236 | }; 237 | }; 238 | }; 239 | buildConfigurationList = 5F4627341B7219BF009695EC /* Build configuration list for PBXProject "EYPopupView_Example" */; 240 | compatibilityVersion = "Xcode 3.2"; 241 | developmentRegion = English; 242 | hasScannedForEncodings = 0; 243 | knownRegions = ( 244 | en, 245 | Base, 246 | "zh-Hans", 247 | ); 248 | mainGroup = 5F4627301B7219BF009695EC; 249 | productRefGroup = 5F46273A1B7219BF009695EC /* Products */; 250 | projectDirPath = ""; 251 | projectRoot = ""; 252 | targets = ( 253 | 5F4627381B7219BF009695EC /* EYPopupView_Example */, 254 | 5F4627511B7219BF009695EC /* EYPopupView_ExampleTests */, 255 | ); 256 | }; 257 | /* End PBXProject section */ 258 | 259 | /* Begin PBXResourcesBuildPhase section */ 260 | 5F4627371B7219BF009695EC /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 5FE9C35C1B8F666C00868E32 /* Localizable.strings in Resources */, 265 | 5F4627481B7219BF009695EC /* Main.storyboard in Resources */, 266 | 5F46274D1B7219BF009695EC /* LaunchScreen.xib in Resources */, 267 | 5F46274A1B7219BF009695EC /* Images.xcassets in Resources */, 268 | 5F4627951B7342B8009695EC /* EYPopupView.bundle in Resources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | 5F4627501B7219BF009695EC /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXResourcesBuildPhase section */ 280 | 281 | /* Begin PBXSourcesBuildPhase section */ 282 | 5F4627351B7219BF009695EC /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 5F4627971B7342B8009695EC /* EYTextPopupView.m in Sources */, 287 | 5F4627451B7219BF009695EC /* ViewController.m in Sources */, 288 | 5F4627961B7342B8009695EC /* EYPopupView.m in Sources */, 289 | 5F1F30CB1B7DEC300025120E /* EYTagView.m in Sources */, 290 | 5F4627421B7219BF009695EC /* AppDelegate.m in Sources */, 291 | 5F1F30CE1B7E00850025120E /* EYTextField.m in Sources */, 292 | 5F3FDFA31B775B6200DE721B /* EYTagPopupView.m in Sources */, 293 | 5F4627941B7342B8009695EC /* EYInputPopupView.m in Sources */, 294 | 5F46273F1B7219BF009695EC /* main.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | 5F46274E1B7219BF009695EC /* Sources */ = { 299 | isa = PBXSourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | 5F4627591B7219BF009695EC /* EYPopupView_ExampleTests.m in Sources */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | /* End PBXSourcesBuildPhase section */ 307 | 308 | /* Begin PBXTargetDependency section */ 309 | 5F4627541B7219BF009695EC /* PBXTargetDependency */ = { 310 | isa = PBXTargetDependency; 311 | target = 5F4627381B7219BF009695EC /* EYPopupView_Example */; 312 | targetProxy = 5F4627531B7219BF009695EC /* PBXContainerItemProxy */; 313 | }; 314 | /* End PBXTargetDependency section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | 5F4627461B7219BF009695EC /* Main.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | 5F4627471B7219BF009695EC /* Base */, 321 | 5FE9C35A1B8F665F00868E32 /* zh-Hans */, 322 | ); 323 | name = Main.storyboard; 324 | sourceTree = ""; 325 | }; 326 | 5F46274B1B7219BF009695EC /* LaunchScreen.xib */ = { 327 | isa = PBXVariantGroup; 328 | children = ( 329 | 5F46274C1B7219BF009695EC /* Base */, 330 | 5FE9C35B1B8F665F00868E32 /* zh-Hans */, 331 | ); 332 | name = LaunchScreen.xib; 333 | sourceTree = ""; 334 | }; 335 | 5FE9C35E1B8F666C00868E32 /* Localizable.strings */ = { 336 | isa = PBXVariantGroup; 337 | children = ( 338 | 5FE9C35D1B8F666C00868E32 /* en */, 339 | 5FE9C35F1B8F666F00868E32 /* zh-Hans */, 340 | ); 341 | name = Localizable.strings; 342 | sourceTree = ""; 343 | }; 344 | /* End PBXVariantGroup section */ 345 | 346 | /* Begin XCBuildConfiguration section */ 347 | 5F46275A1B7219BF009695EC /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ALWAYS_SEARCH_USER_PATHS = NO; 351 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 352 | CLANG_CXX_LIBRARY = "libc++"; 353 | CLANG_ENABLE_MODULES = YES; 354 | CLANG_ENABLE_OBJC_ARC = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_CONSTANT_CONVERSION = YES; 357 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 358 | CLANG_WARN_EMPTY_BODY = YES; 359 | CLANG_WARN_ENUM_CONVERSION = YES; 360 | CLANG_WARN_INT_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_UNREACHABLE_CODE = YES; 363 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 364 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 365 | COPY_PHASE_STRIP = NO; 366 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 367 | ENABLE_STRICT_OBJC_MSGSEND = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 384 | MTL_ENABLE_DEBUG_INFO = YES; 385 | ONLY_ACTIVE_ARCH = YES; 386 | SDKROOT = iphoneos; 387 | }; 388 | name = Debug; 389 | }; 390 | 5F46275B1B7219BF009695EC /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ALWAYS_SEARCH_USER_PATHS = NO; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INT_CONVERSION = YES; 404 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 405 | CLANG_WARN_UNREACHABLE_CODE = YES; 406 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 407 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 408 | COPY_PHASE_STRIP = NO; 409 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 410 | ENABLE_NS_ASSERTIONS = NO; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | GCC_C_LANGUAGE_STANDARD = gnu99; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 416 | GCC_WARN_UNDECLARED_SELECTOR = YES; 417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 418 | GCC_WARN_UNUSED_FUNCTION = YES; 419 | GCC_WARN_UNUSED_VARIABLE = YES; 420 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 421 | MTL_ENABLE_DEBUG_INFO = NO; 422 | SDKROOT = iphoneos; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | 5F46275D1B7219BF009695EC /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 431 | INFOPLIST_FILE = EYPopupView_Example/Info.plist; 432 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | }; 435 | name = Debug; 436 | }; 437 | 5F46275E1B7219BF009695EC /* Release */ = { 438 | isa = XCBuildConfiguration; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | INFOPLIST_FILE = EYPopupView_Example/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | }; 445 | name = Release; 446 | }; 447 | 5F4627601B7219BF009695EC /* Debug */ = { 448 | isa = XCBuildConfiguration; 449 | buildSettings = { 450 | BUNDLE_LOADER = "$(TEST_HOST)"; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(SDKROOT)/Developer/Library/Frameworks", 453 | "$(inherited)", 454 | ); 455 | GCC_PREPROCESSOR_DEFINITIONS = ( 456 | "DEBUG=1", 457 | "$(inherited)", 458 | ); 459 | INFOPLIST_FILE = EYPopupView_ExampleTests/Info.plist; 460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EYPopupView_Example.app/EYPopupView_Example"; 463 | }; 464 | name = Debug; 465 | }; 466 | 5F4627611B7219BF009695EC /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | BUNDLE_LOADER = "$(TEST_HOST)"; 470 | FRAMEWORK_SEARCH_PATHS = ( 471 | "$(SDKROOT)/Developer/Library/Frameworks", 472 | "$(inherited)", 473 | ); 474 | INFOPLIST_FILE = EYPopupView_ExampleTests/Info.plist; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EYPopupView_Example.app/EYPopupView_Example"; 478 | }; 479 | name = Release; 480 | }; 481 | /* End XCBuildConfiguration section */ 482 | 483 | /* Begin XCConfigurationList section */ 484 | 5F4627341B7219BF009695EC /* Build configuration list for PBXProject "EYPopupView_Example" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | 5F46275A1B7219BF009695EC /* Debug */, 488 | 5F46275B1B7219BF009695EC /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 5F46275C1B7219BF009695EC /* Build configuration list for PBXNativeTarget "EYPopupView_Example" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 5F46275D1B7219BF009695EC /* Debug */, 497 | 5F46275E1B7219BF009695EC /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 5F46275F1B7219BF009695EC /* Build configuration list for PBXNativeTarget "EYPopupView_ExampleTests" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 5F4627601B7219BF009695EC /* Debug */, 506 | 5F4627611B7219BF009695EC /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | /* End XCConfigurationList section */ 512 | }; 513 | rootObject = 5F4627311B7219BF009695EC /* Project object */; 514 | } 515 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. 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 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 37 | 46 | 55 | 64 | 73 | 82 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.appcpu.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "EYPopupViewHeader.h" 11 | 12 | @interface ViewController () 13 | @property (nonatomic, strong) NSArray* tags; 14 | @property (nonatomic, strong) NSArray* selectedTags; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | _tags=@[ 23 | @"dog", 24 | @"cat", 25 | @"pig", 26 | @"duck", 27 | @"horse", 28 | @"elephant", 29 | @"ant", 30 | @"fish", 31 | @"bird", 32 | @"engle", 33 | @"snake", 34 | @"mouse", 35 | @"squirrel", 36 | @"beaver", 37 | @"kangaroo", 38 | @"monkey", 39 | @"panda", 40 | @"bear", 41 | @"lion", 42 | ]; 43 | _selectedTags=@[ 44 | @"dog", 45 | @"pig", 46 | @"elephant", 47 | @"ant", 48 | @"fish", 49 | @"engle", 50 | @"snake", 51 | @"beaver", 52 | @"kangaroo", 53 | @"panda", 54 | @"lion", 55 | ]; 56 | 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | #pragma mark - show text 64 | - (IBAction)showSingleTextPopView:(id)sender { 65 | [EYTextPopupView popViewWithTitle:@"I am title. " contentText:@"I am context. " 66 | leftButtonTitle:EYLOCALSTRING(@"Cancel") 67 | rightButtonTitle:EYLOCALSTRING(@"OK") 68 | leftBlock:^() { 69 | NSLog(@"left button clicked"); 70 | } 71 | rightBlock:^() { 72 | NSLog(@"left button clicked"); 73 | } 74 | dismissBlock:^() { 75 | NSLog(@"Do something interesting after dismiss block"); 76 | }]; 77 | 78 | } 79 | - (IBAction)showMutliTextPopView:(id)sender { 80 | [EYTextPopupView popViewWithTitle:@"I am title. " contentText:@"I am context. \nThe easiest place to start is translating your app description for each of the countries in which you offer apps. Customers are more likely to read about your app if it’s in their native language. It just makes it easier for more people to learn about your app. For details on localizing metadata, keywords, and screenshots, read the iTunes Connect Developer Guide." 81 | leftButtonTitle:EYLOCALSTRING(@"Cancel") 82 | rightButtonTitle:EYLOCALSTRING(@"OK") 83 | leftBlock:^() { 84 | NSLog(@"left button clicked"); 85 | } 86 | rightBlock:^() { 87 | NSLog(@"left button clicked"); 88 | } 89 | dismissBlock:^() { 90 | NSLog(@"Do something interesting after dismiss block"); 91 | }]; 92 | } 93 | - (IBAction)showScrollTextPopView:(id)sender { 94 | [EYTextPopupView popViewWithTitle:@"I am title. " contentText:@"I am context. \nThe easiest place to start is translating your app description for each of the countries in which you offer apps. Customers are more likely to read about your app if it’s in their native language. It just makes it easier for more people to learn about your app. For details on localizing metadata, keywords, and screenshots, read the iTunes Connect Developer Guide.The easiest place to start is translating your app description for each of the countries in which you offer apps. Customers are more likely to read about your app if it’s in their native language. It just makes it easier for more people to learn about your app. For details on localizing metadata, keywords, and screenshots, read the iTunes Connect Developer Guide." 95 | leftButtonTitle:EYLOCALSTRING(@"Cancel") 96 | rightButtonTitle:EYLOCALSTRING(@"OK") 97 | leftBlock:^() { 98 | NSLog(@"left button clicked"); 99 | } 100 | rightBlock:^() { 101 | NSLog(@"left button clicked"); 102 | } 103 | dismissBlock:^() { 104 | NSLog(@"Do something interesting after dismiss block"); 105 | }]; 106 | } 107 | #pragma mark - input 108 | 109 | 110 | - (IBAction)showSingleLineInputView:(id)sender { 111 | [EYInputPopupView popViewWithTitle:@"I am title. I am title. I am title. I am title. " contentText:@"Do somethi" 112 | type:EYInputPopupView_Type_single_line_text 113 | cancelBlock:^{ 114 | 115 | } confirmBlock:^(UIView *view, NSString *text) { 116 | 117 | } dismissBlock:^{ 118 | 119 | }]; 120 | 121 | } 122 | - (IBAction)showMultiLineInputView:(id)sender { 123 | [EYInputPopupView popViewWithTitle:@"I am title. I am title. I am title. I am title. " contentText:@"The easiest place to st Connect Developer Guide." 124 | type:EYInputPopupView_Type_multi_line 125 | cancelBlock:^{ 126 | 127 | } confirmBlock:^(UIView *view, NSString *text) { 128 | 129 | } dismissBlock:^{ 130 | 131 | }]; 132 | } 133 | 134 | 135 | - (IBAction)showTagEditView:(id)sender { 136 | 137 | [EYTagPopupView popViewWithTitle:@"I am title. I am title. I am title. I am title. " 138 | tags:_tags 139 | type:EYTagPopupView_Type_Edit 140 | cancelBlock:^{ 141 | 142 | } confirmBlock:^(UIView *view, NSArray *tags) { 143 | NSLog(@"tags: %@",tags); 144 | } dismissBlock:^{ 145 | 146 | }]; 147 | } 148 | - (IBAction)showRadioTag:(id)sender { 149 | [EYTagPopupView popViewWithTitle:@"I am title. I am title. I am title. I am title. " 150 | tags:_tags 151 | type:EYTagPopupView_Type_Single_Selected 152 | cancelBlock:^{ 153 | 154 | } confirmBlock:^(UIView *view, NSArray *tags) { 155 | NSLog(@"tags: %@",tags); 156 | } dismissBlock:^{ 157 | 158 | }]; 159 | } 160 | 161 | - (IBAction)showCheckboxTag:(id)sender { 162 | [EYTagPopupView popViewWithTitle:@"I am title. I am title. I am title. I am title. " 163 | tags:_tags 164 | selectTags:_selectedTags 165 | type:EYTagPopupView_Type_Multi_Selected 166 | cancelBlock:^{ 167 | 168 | } confirmBlock:^(UIView *view, NSArray *tags) { 169 | NSLog(@"tags: %@",tags); 170 | } dismissBlock:^{ 171 | 172 | }]; 173 | 174 | } 175 | 176 | 177 | 178 | 179 | 180 | @end 181 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Cancel"="Cancel"; 2 | "OK"="OK"; 3 | "Add Tag"="Add Tag"; -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. 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 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/zh-Hans.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = " Copyright (c) 2015 Eric Yang. All rights reserved."; ObjectID = "8ie-xW-0ye"; */ 3 | "8ie-xW-0ye.text" = " Copyright (c) 2015 Eric Yang. All rights reserved."; 4 | 5 | /* Class = "UILabel"; text = "EYPopupView_Example"; ObjectID = "kId-c2-rCX"; */ 6 | "kId-c2-rCX.text" = "EYPopupView_Example"; 7 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Cancel"="取消"; 2 | "OK"="确定"; 3 | "Add Tag"="添加标签"; -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_Example/zh-Hans.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UIButton"; normalTitle = "show single text"; ObjectID = "9m7-as-xnb"; */ 3 | "9m7-as-xnb.normalTitle" = "show single text"; 4 | 5 | /* Class = "UIButton"; normalTitle = "show radio tag"; ObjectID = "ESa-zy-aCM"; */ 6 | "ESa-zy-aCM.normalTitle" = "show radio tag"; 7 | 8 | /* Class = "UIButton"; normalTitle = "show tag edit view"; ObjectID = "KCY-S4-Xse"; */ 9 | "KCY-S4-Xse.normalTitle" = "show tag edit view"; 10 | 11 | /* Class = "UIButton"; normalTitle = "show single line input view"; ObjectID = "Ma0-Cf-y8Z"; */ 12 | "Ma0-Cf-y8Z.normalTitle" = "show single line input view"; 13 | 14 | /* Class = "UIButton"; normalTitle = "show multi line input view"; ObjectID = "TWb-2o-XoD"; */ 15 | "TWb-2o-XoD.normalTitle" = "show multi line input view"; 16 | 17 | /* Class = "UIButton"; normalTitle = "show checkbox tag"; ObjectID = "WiD-XX-kh1"; */ 18 | "WiD-XX-kh1.normalTitle" = "show checkbox tag"; 19 | 20 | /* Class = "UIButton"; normalTitle = "show multi text"; ObjectID = "XcB-5d-aEz"; */ 21 | "XcB-5d-aEz.normalTitle" = "show multi text"; 22 | 23 | /* Class = "UIButton"; normalTitle = "show scroll text"; ObjectID = "xlP-xy-EXp"; */ 24 | "xlP-xy-EXp.normalTitle" = "show scroll text"; 25 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_ExampleTests/EYPopupView_ExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYPopupView_ExampleTests.m 3 | // EYPopupView_ExampleTests 4 | // 5 | // Created by ericyang on 8/5/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface EYPopupView_ExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation EYPopupView_ExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /EYPopupView_Example/EYPopupView_ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.appcpu.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /EYTagView/EYTagView/EYTagView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagView.h 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | // 9 | // Current Version Time: 2015-08-27 10 | // 11 | 12 | #import 13 | 14 | 15 | 16 | #define COLORRGBA(c,a) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 17 | green:((c>>8)&0xFF)/255.0 \ 18 | blue:(c&0xFF)/255.0 \ 19 | alpha:a] 20 | #define COLORRGB(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 21 | green:((c>>8)&0xFF)/255.0 \ 22 | blue:(c&0xFF)/255.0 \ 23 | alpha:1.0] 24 | 25 | 26 | 27 | #define _K_SCREEN_WIDTH ([[UIScreen mainScreen ] bounds ].size.width) 28 | 29 | #ifndef DEBUG_LOG 30 | #define DEBUG_LOG 31 | #define LOGERROR NSLog(@"error !!!!!!!!! %s,%d",__FUNCTION__,__LINE__); 32 | #define LOGWARNING NSLog(@"warning %s,%d",__FUNCTION__,__LINE__); 33 | #define LOGERRORMSG(msg) NSLog(@"error:%@ %s,%d",msg,__FUNCTION__,__LINE__); 34 | #define LOGLINE NSLog(@"info %s,%d",__FUNCTION__,__LINE__); 35 | #define LOGINFO(format,value) NSLog([NSString stringWithFormat:@"%@ ; info %%s,%%d",format],value,__FUNCTION__,__LINE__); 36 | #define LOGTEXT(value) NSLog(@"%@ ; info %s,%d",value,__FUNCTION__,__LINE__); 37 | #define LOGTODO NSLog(@"TODO !!!!! ; info %s,%d",__FUNCTION__,__LINE__); 38 | #define LOGTIME NSLog(@"%f %s,%d",[[NSDate date]timeIntervalSince1970],__FUNCTION__,__LINE__); 39 | 40 | #define LOGNOTHING(format,value) 41 | #endif 42 | 43 | @class EYTagView; 44 | @protocol EYTagViewDelegate 45 | 46 | @optional 47 | -(void)heightDidChangedTagView:(EYTagView*)tagView; 48 | 49 | @end 50 | 51 | typedef enum{ 52 | EYTagView_Type_Edit, 53 | EYTagView_Type_Display, 54 | EYTagView_Type_Single_Selected, 55 | EYTagView_Type_Multi_Selected, 56 | }EYTagView_Type; 57 | 58 | @interface EYTagView : UIView 59 | @property (nonatomic, strong) id delegate; 60 | @property (nonatomic, strong) UITextField* tfInput; 61 | @property (nonatomic) EYTagView_Type type;//default edit 62 | 63 | 64 | @property (nonatomic) float tagHeight;//default 65 | 66 | @property (nonatomic) float viewMaxHeight; 67 | 68 | @property (nonatomic) CGSize tagPaddingSize;//top & left 69 | @property (nonatomic) CGSize textPaddingSize; 70 | 71 | 72 | @property (nonatomic, strong) UIFont* fontTag; 73 | @property (nonatomic, strong) UIFont* fontInput; 74 | 75 | 76 | @property (nonatomic, strong) UIColor* colorTag; 77 | @property (nonatomic, strong) UIColor* colorInput; 78 | @property (nonatomic, strong) UIColor* colorInputPlaceholder; 79 | 80 | @property (nonatomic, strong) UIColor* colorTagBg; 81 | @property (nonatomic, strong) UIColor* colorInputBg; 82 | @property (nonatomic, strong) UIColor* colorInputBoard; 83 | 84 | 85 | - (void)addTags:(NSArray *)tags; 86 | - (void)addTags:(NSArray *)tags selectedTags:(NSArray*)selectedTags; 87 | -(void)layoutTagviews; 88 | -(void)setTagStringsSelected:(NSMutableArray *)tagStringsSelected; 89 | -(NSMutableArray *)tagStrings; 90 | @end 91 | -------------------------------------------------------------------------------- /EYTagView/EYTagView/EYTagView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagView.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | 10 | 11 | 12 | 13 | #import "EYTagView.h" 14 | #import "EYTextField.h" 15 | 16 | #ifndef EYLOCALSTRING 17 | #define EYLOCALSTRING(STR) NSLocalizedString(STR, STR) 18 | #endif 19 | 20 | @interface EYCheckBoxButton :UIButton 21 | @property (nonatomic, strong) UIColor* colorBg; 22 | @property (nonatomic, strong) UIColor* colorText; 23 | @end 24 | 25 | @implementation EYCheckBoxButton 26 | -(void)setSelected:(BOOL)selected{ 27 | [super setSelected:selected]; 28 | if (selected) { 29 | [self setBackgroundColor:_colorBg]; 30 | [self setTitleColor:_colorText forState:UIControlStateSelected]; 31 | } else { 32 | [self setBackgroundColor:_colorText]; 33 | self.layer.borderColor=_colorBg.CGColor; 34 | self.layer.borderWidth=1; 35 | [self setTitleColor:_colorBg forState:UIControlStateNormal]; 36 | } 37 | [self setNeedsDisplay]; 38 | } 39 | @end 40 | 41 | 42 | @interface EYTagView() 43 | 44 | @property (nonatomic, strong) UIScrollView* svContainer; 45 | @property (nonatomic, strong) NSMutableArray *tagButtons;//array of alll tag button 46 | @property (nonatomic, strong) NSMutableArray *tagStrings;//check whether tag is duplicated 47 | @property (nonatomic, strong) NSMutableArray *tagStringsSelected; 48 | 49 | @end 50 | 51 | @implementation EYTagView 52 | { 53 | NSInteger _editingTagIndex; 54 | } 55 | 56 | 57 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 58 | { 59 | self = [super initWithCoder:aDecoder]; 60 | if (self) { 61 | [self commonInit]; 62 | } 63 | return self; 64 | } 65 | 66 | - (instancetype)initWithFrame:(CGRect)frame 67 | { 68 | self = [super initWithFrame:frame]; 69 | if (self) { 70 | [self commonInit]; 71 | } 72 | return self; 73 | } 74 | 75 | 76 | - (void)commonInit 77 | { 78 | _type=EYTagView_Type_Edit; 79 | _tagHeight=18; 80 | _tagPaddingSize=CGSizeMake(6, 6); 81 | _textPaddingSize=CGSizeMake(0, 3); 82 | _fontTag=[UIFont systemFontOfSize:14]; 83 | self.fontInput=[UIFont systemFontOfSize:14]; 84 | _colorTag=COLORRGB(0xffffff); 85 | _colorInput=COLORRGB(0x2ab44e); 86 | _colorInputPlaceholder=COLORRGB(0x2ab44e); 87 | _colorTagBg=COLORRGB(0x2ab44e); 88 | _colorInputBg=COLORRGB(0xbbbbbb); 89 | _colorInputBoard=COLORRGB(0x2ab44e); 90 | _viewMaxHeight=130; 91 | self.backgroundColor=COLORRGB(0xffffff); 92 | 93 | _tagButtons=[NSMutableArray new]; 94 | _tagStrings=[NSMutableArray new]; 95 | _tagStringsSelected=[NSMutableArray new]; 96 | 97 | { 98 | UIScrollView* sv = [[UIScrollView alloc] initWithFrame:self.bounds]; 99 | sv.contentSize=sv.frame.size; 100 | sv.contentSize=CGSizeMake(sv.frame.size.width, 600); 101 | sv.indicatorStyle=UIScrollViewIndicatorStyleDefault; 102 | sv.backgroundColor = self.backgroundColor; 103 | sv.showsVerticalScrollIndicator = YES; 104 | sv.showsHorizontalScrollIndicator = NO; 105 | [self addSubview:sv]; 106 | _svContainer=sv; 107 | } 108 | { 109 | UITextField* tf = [[EYTextField alloc] initWithFrame:CGRectMake(0, 0, 0, _tagHeight)]; 110 | tf.autocorrectionType = UITextAutocorrectionTypeNo; 111 | [tf addTarget:self action:@selector(textFieldDidChange:)forControlEvents:UIControlEventEditingChanged]; 112 | tf.delegate = self; 113 | tf.placeholder=EYLOCALSTRING(@"Add Tag"); 114 | 115 | tf.returnKeyType = UIReturnKeyDone; 116 | [_svContainer addSubview:tf]; 117 | _tfInput=tf; 118 | } 119 | { 120 | UITapGestureRecognizer* panGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handlerTapGesture:)]; 121 | panGestureRecognizer.numberOfTapsRequired=1; 122 | [self addGestureRecognizer:panGestureRecognizer]; 123 | } 124 | } 125 | #pragma mark - 126 | -(NSMutableArray *)tagStrings{ 127 | switch (_type) { 128 | case EYTagView_Type_Edit: 129 | { 130 | return _tagStrings; 131 | } 132 | break; 133 | case EYTagView_Type_Display: 134 | { 135 | return nil; 136 | } 137 | break; 138 | case EYTagView_Type_Single_Selected: 139 | { 140 | [_tagStringsSelected removeAllObjects]; 141 | for (EYCheckBoxButton* button in _tagButtons) { 142 | if (button.selected) { 143 | [_tagStringsSelected addObject:button.titleLabel.text]; 144 | break; 145 | } 146 | } 147 | return _tagStringsSelected; 148 | } 149 | break; 150 | case EYTagView_Type_Multi_Selected: 151 | { 152 | [_tagStringsSelected removeAllObjects]; 153 | for (EYCheckBoxButton* button in _tagButtons) { 154 | if (button.selected) { 155 | [_tagStringsSelected addObject:button.titleLabel.text]; 156 | } 157 | } 158 | return _tagStringsSelected; 159 | } 160 | break; 161 | default: 162 | { 163 | 164 | } 165 | break; 166 | } 167 | return nil; 168 | } 169 | 170 | 171 | -(void)layoutTagviews{ 172 | float oldContentHeight=_svContainer.contentSize.height; 173 | float offsetX=_tagPaddingSize.width,offsetY=_tagPaddingSize.height; 174 | 175 | for (int i=0; i<_tagButtons.count; i++) { 176 | EYCheckBoxButton* tagButton=_tagButtons[i]; 177 | CGRect frame=tagButton.frame; 178 | 179 | if (tagButton.frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 180 | NSLog(@"!!! tagButton width tooooooooo large"); 181 | }else{ 182 | if ((offsetX+tagButton.frame.size.width+_tagPaddingSize.width) 183 | <=_svContainer.contentSize.width) { 184 | frame.origin.x=offsetX; 185 | frame.origin.y=offsetY; 186 | offsetX+=tagButton.frame.size.width+_tagPaddingSize.width; 187 | }else{ 188 | offsetX=_tagPaddingSize.width; 189 | offsetY+=_tagHeight+_tagPaddingSize.height; 190 | 191 | frame.origin.x=offsetX; 192 | frame.origin.y=offsetY; 193 | offsetX+=tagButton.frame.size.width+_tagPaddingSize.width; 194 | } 195 | tagButton.frame=frame; 196 | } 197 | } 198 | //input view 199 | _tfInput.hidden=(_type!=EYTagView_Type_Edit); 200 | if (_type==EYTagView_Type_Edit) { 201 | _tfInput.backgroundColor=_colorInputBg; 202 | _tfInput.textColor=_colorInput; 203 | _tfInput.font=_fontInput; 204 | [_tfInput setValue:_colorInputPlaceholder forKeyPath:@"_placeholderLabel.textColor"]; 205 | 206 | _tfInput.layer.cornerRadius = _tfInput.frame.size.height * 0.5f; 207 | _tfInput.layer.borderColor=_colorInputBoard.CGColor; 208 | _tfInput.layer.borderWidth=1; 209 | { 210 | CGRect frame=_tfInput.frame; 211 | frame.size.width = [_tfInput.text sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 212 | //place holde width 213 | frame.size.width=MAX(frame.size.width, [EYLOCALSTRING(@"Add Tag") sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2); 214 | _tfInput.frame=frame; 215 | } 216 | 217 | if (_tfInput.frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 218 | NSLog(@"!!! _tfInput width tooooooooo large"); 219 | 220 | }else{ 221 | CGRect frame=_tfInput.frame; 222 | if ((offsetX+_tfInput.frame.size.width+_tagPaddingSize.width) 223 | <=_svContainer.contentSize.width) { 224 | frame.origin.x=offsetX; 225 | frame.origin.y=offsetY; 226 | offsetX+=_tfInput.frame.size.width+_tagPaddingSize.width; 227 | }else{ 228 | offsetX=_tagPaddingSize.width; 229 | offsetY+=_tagHeight+_tagPaddingSize.height; 230 | 231 | frame.origin.x=offsetX; 232 | frame.origin.y=offsetY; 233 | offsetX+=_tfInput.frame.size.width+_tagPaddingSize.width; 234 | } 235 | _tfInput.frame=frame; 236 | 237 | } 238 | 239 | } 240 | 241 | _svContainer.contentSize=CGSizeMake(_svContainer.contentSize.width, offsetY+_tagHeight+_tagPaddingSize.height); 242 | { 243 | CGRect frame=_svContainer.frame; 244 | frame.size.height=_svContainer.contentSize.height; 245 | frame.size.height=MIN(frame.size.height, _viewMaxHeight); 246 | _svContainer.frame=frame; 247 | } 248 | { 249 | CGRect frame=self.frame; 250 | frame.size.height=_svContainer.frame.size.height; 251 | self.frame=frame; 252 | } 253 | if (_delegate) { 254 | [_delegate heightDidChangedTagView:self]; 255 | } 256 | if (oldContentHeight != _svContainer.contentSize.height) { 257 | CGPoint bottomOffset = CGPointMake(0, _svContainer.contentSize.height - _svContainer.bounds.size.height); 258 | [_svContainer setContentOffset:bottomOffset animated:YES]; 259 | } 260 | } 261 | 262 | - (EYCheckBoxButton *)tagButtonWithTag:(NSString *)tag 263 | { 264 | EYCheckBoxButton *tagBtn = [[EYCheckBoxButton alloc] init]; 265 | tagBtn.colorBg=_colorTagBg; 266 | tagBtn.colorText=_colorTag; 267 | tagBtn.selected=YES; 268 | [tagBtn.titleLabel setFont:_fontTag]; 269 | [tagBtn setBackgroundColor:_colorTagBg]; 270 | [tagBtn setTitleColor:_colorTag forState:UIControlStateNormal]; 271 | [tagBtn addTarget:self action:@selector(handlerTagButtonEvent:) forControlEvents:UIControlEventTouchUpInside]; 272 | [tagBtn setTitle:tag forState:UIControlStateNormal]; 273 | 274 | CGRect btnFrame; 275 | btnFrame.size.height = _tagHeight; 276 | tagBtn.layer.cornerRadius = btnFrame.size.height * 0.5f; 277 | 278 | btnFrame.size.width = [tagBtn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:_fontTag}].width + (tagBtn.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 279 | 280 | tagBtn.frame=btnFrame; 281 | return tagBtn; 282 | } 283 | - (void)handlerTagButtonEvent:(EYCheckBoxButton*)sender 284 | { 285 | 286 | } 287 | #pragma mark action 288 | 289 | - (void)addTags:(NSArray *)tags{ 290 | for (NSString *tag in tags) 291 | { 292 | [self addTagToLast:tag]; 293 | } 294 | [self layoutTagviews]; 295 | } 296 | - (void)addTags:(NSArray *)tags selectedTags:(NSArray*)selectedTags{ 297 | [self addTags:tags]; 298 | self.tagStringsSelected=[NSMutableArray arrayWithArray:selectedTags]; 299 | } 300 | - (void)addTagToLast:(NSString *)tag{ 301 | NSArray *result = [_tagStrings filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", tag]]; 302 | if (result.count == 0) 303 | { 304 | [_tagStrings addObject:tag]; 305 | 306 | EYCheckBoxButton* tagButton=[self tagButtonWithTag:tag]; 307 | [tagButton addTarget:self action:@selector(handlerButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 308 | [_svContainer addSubview:tagButton]; 309 | [_tagButtons addObject:tagButton]; 310 | 311 | switch (_type) { 312 | case EYTagView_Type_Single_Selected: 313 | case EYTagView_Type_Multi_Selected: 314 | { 315 | tagButton.selected=NO; 316 | } 317 | break; 318 | default: 319 | break; 320 | } 321 | } 322 | [self layoutTagviews]; 323 | } 324 | 325 | - (void)removeTags:(NSArray *)tags{ 326 | for (NSString *tag in tags) 327 | { 328 | [self removeTag:tag]; 329 | } 330 | [self layoutTagviews]; 331 | } 332 | - (void)removeTag:(NSString *)tag{ 333 | NSArray *result = [_tagStrings filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", tag]]; 334 | if (result) 335 | { 336 | NSInteger index=[_tagStrings indexOfObject:tag]; 337 | [_tagStrings removeObjectAtIndex:index]; 338 | [_tagButtons[index] removeFromSuperview]; 339 | [_tagButtons removeObjectAtIndex:index]; 340 | } 341 | [self layoutTagviews]; 342 | } 343 | 344 | 345 | -(void)handlerButtonAction:(EYCheckBoxButton*)tagButton{ 346 | switch (_type) { 347 | case EYTagView_Type_Edit: 348 | { 349 | [self becomeFirstResponder]; 350 | _editingTagIndex=[_tagButtons indexOfObject:tagButton]; 351 | CGRect buttonFrame=tagButton.frame; 352 | buttonFrame.size.height-=5; 353 | 354 | UIMenuController *menuController = [UIMenuController sharedMenuController]; 355 | UIMenuItem *resetMenuItem = [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(deleteItemClicked:)]; 356 | 357 | NSAssert([self becomeFirstResponder], @"Sorry, UIMenuController will not work with %@ since it cannot become first responder", self); 358 | [menuController setMenuItems:[NSArray arrayWithObject:resetMenuItem]]; 359 | [menuController setTargetRect:buttonFrame inView:_svContainer]; 360 | [menuController setMenuVisible:YES animated:YES]; 361 | } 362 | break; 363 | case EYTagView_Type_Single_Selected: 364 | { 365 | if (tagButton.selected) { 366 | tagButton.selected=NO; 367 | }else{ 368 | for (EYCheckBoxButton* button in _tagButtons) { 369 | button.selected=NO; 370 | } 371 | tagButton.selected=YES; 372 | } 373 | } 374 | break; 375 | case EYTagView_Type_Multi_Selected: 376 | { 377 | tagButton.selected=!tagButton.selected; 378 | } 379 | break; 380 | default: 381 | { 382 | 383 | } 384 | break; 385 | } 386 | 387 | } 388 | 389 | 390 | #pragma mark UITextFieldDelegate 391 | 392 | 393 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 394 | [textField resignFirstResponder]; 395 | if (!textField.text 396 | || [textField.text isEqualToString:@""]) { 397 | return NO; 398 | } 399 | [self addTagToLast:textField.text]; 400 | textField.text=nil; 401 | [self layoutTagviews]; 402 | return NO; 403 | } 404 | 405 | -(void)textFieldDidChange:(UITextField*)textField{ 406 | [self layoutTagviews]; 407 | } 408 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 409 | 410 | NSString* sting2= [textField.text stringByReplacingCharactersInRange:range withString:string]; 411 | 412 | CGRect frame=_tfInput.frame; 413 | frame.size.width = [sting2 sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 414 | frame.size.width=MAX(frame.size.width, [EYLOCALSTRING(@"Add Tag") sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2); 415 | 416 | if (frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 417 | NSLog(@"!!! _tfInput width tooooooooo large"); 418 | return NO; 419 | } 420 | else{ 421 | return YES; 422 | } 423 | } 424 | -(void)textFieldDidBeginEditing:(UITextField *)textField{ 425 | if ([_delegate conformsToProtocol:@protocol(UITextFieldDelegate)] 426 | && [_delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) { 427 | [_delegate performSelector:@selector(textFieldDidBeginEditing:) withObject:textField]; 428 | } 429 | } 430 | 431 | 432 | -(void)textFieldDidEndEditing:(UITextField *)textField{ 433 | [self layoutTagviews]; 434 | if ([_delegate conformsToProtocol:@protocol(UITextFieldDelegate)] 435 | && [_delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) { 436 | [_delegate performSelector:@selector(textFieldDidEndEditing:) withObject:textField]; 437 | } 438 | } 439 | #pragma mark UIMenuController 440 | 441 | - (void) deleteItemClicked:(id) sender { 442 | [self removeTag:_tagStrings[_editingTagIndex]]; 443 | } 444 | - (BOOL) canPerformAction:(SEL)selector withSender:(id) sender { 445 | if (selector == @selector(deleteItemClicked:) /*|| selector == @selector(copy:)*/ /*<--enable that if you want the copy item */) { 446 | return YES; 447 | } 448 | return NO; 449 | } 450 | - (BOOL) canBecomeFirstResponder { 451 | return YES; 452 | } 453 | - (void)handlerTapGesture:(UIPanGestureRecognizer *)recognizer { 454 | [[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES]; 455 | if (_tfInput.isFirstResponder 456 | && _type==EYTagView_Type_Edit 457 | && _tfInput.text) { 458 | NSString* pureStr=[_tfInput.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 459 | if (pureStr 460 | && ![pureStr isEqualToString:@""]) { 461 | [self addTagToLast:pureStr]; 462 | _tfInput.text=nil; 463 | [self layoutTagviews]; 464 | 465 | } 466 | 467 | } 468 | } 469 | #pragma mark getter & setter 470 | -(void)setBackgroundColor:(UIColor *)backgroundColor{ 471 | [super setBackgroundColor:backgroundColor]; 472 | _svContainer.backgroundColor=backgroundColor; 473 | } 474 | -(void)setType:(EYTagView_Type)type{ 475 | _type=type; 476 | switch (_type) { 477 | case EYTagView_Type_Edit: 478 | { 479 | for (UIButton* button in _tagButtons) { 480 | button.selected=YES; 481 | } 482 | } 483 | break; 484 | case EYTagView_Type_Display: 485 | { 486 | for (UIButton* button in _tagButtons) { 487 | button.selected=YES; 488 | } 489 | } 490 | break; 491 | case EYTagView_Type_Single_Selected: 492 | { 493 | for (UIButton* button in _tagButtons) { 494 | button.selected=[_tagStringsSelected containsObject:button.titleLabel.text]; 495 | } 496 | } 497 | break; 498 | case EYTagView_Type_Multi_Selected: 499 | { 500 | for (UIButton* button in _tagButtons) { 501 | button.selected=[_tagStringsSelected containsObject:button.titleLabel.text]; 502 | } 503 | } 504 | break; 505 | default: 506 | { 507 | 508 | } 509 | break; 510 | } 511 | [self layoutTagviews]; 512 | } 513 | -(void)setColorTagBg:(UIColor *)colorTagBg{ 514 | _colorTagBg=colorTagBg; 515 | for (EYCheckBoxButton* button in _tagButtons) { 516 | button.colorBg=colorTagBg; 517 | } 518 | } 519 | -(void)setColorTag:(UIColor *)colorTag{ 520 | _colorTag=colorTag; 521 | for (EYCheckBoxButton* button in _tagButtons) { 522 | button.colorText=colorTag; 523 | } 524 | } 525 | -(void)setTagStringsSelected:(NSMutableArray *)tagStringsSelected{ 526 | _tagStringsSelected=tagStringsSelected; 527 | switch (_type) { 528 | case EYTagView_Type_Single_Selected: 529 | case EYTagView_Type_Multi_Selected: 530 | { 531 | for (UIButton* button in _tagButtons) { 532 | button.selected=[tagStringsSelected containsObject:button.titleLabel.text]; 533 | } 534 | } 535 | break; 536 | default: 537 | { 538 | 539 | } 540 | break; 541 | } 542 | } 543 | 544 | @end 545 | -------------------------------------------------------------------------------- /EYTagView/EYTagView/EYTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextField.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/14/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EYTextField : UITextField 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EYTagView/EYTagView/EYTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextField.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/14/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYTextField.h" 10 | 11 | @implementation EYTextField 12 | 13 | // placeholder position 14 | - (CGRect)textRectForBounds:(CGRect)bounds { 15 | return CGRectInset( bounds , 9 , 0 ); 16 | } 17 | 18 | // text position 19 | - (CGRect)editingRectForBounds:(CGRect)bounds { 20 | return CGRectInset( bounds , 9 , 0 ); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # EYPopupView 2 | 3 | ------ 4 | 5 | EYPopupView is a perfect pop view which you can show/input many kinds of things, like : single-line text, multiple lines text, tags, radio or checkboxs. 6 | 7 | --- 8 | 9 | ####EYPopupView has a sub project [EYTagView](https://github.com/ygweric/EYTagView) 10 | 11 | --- 12 | ### Why will you use EYPopupView 13 | 14 | In most iOS App, users always need to show or input lots of things, such as commends, notes, messages, tags, we need to handler the frame of the UITextfield/UITextView, and we have to move the view up and donw depending the keyboard. it always take we( and me :-D ) lots of time and energy. 15 | 16 | Those are the reason I wrote EYPopupView, which you can do those things with only one line code . 17 | 18 | I will improve this project always, so you can push your request or the issuse helping me improve EYPopupView. 19 | 20 | ### UPDATE: realize Internationalize 27/8/2015 21 | 22 | ![eng-text.png](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/eng-text.png) 23 | ![eng_tag.png](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/eng_tag.png) 24 | 25 | 26 | ###What can EYPopupView do and How to use it. 27 | 28 | 1\ show single line alert 29 | 30 | ![single-line-display.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/single-line-display.gif) 31 | 32 | ``` 33 | [EYTextPopupView popViewWithTitle:@"我是标题" contentText:@"我是正文" 34 | leftButtonTitle:@"左键" 35 | rightButtonTitle:@"右键" 36 | leftBlock:^() { 37 | NSLog(@"left button clicked"); 38 | } 39 | rightBlock:^() { 40 | NSLog(@"left button clicked"); 41 | } 42 | dismissBlock:^() { 43 | NSLog(@"Do something interesting after dismiss block"); 44 | }]; 45 | ``` 46 | 47 | 2\ show multiple lines alert 48 | 49 | ![multi-line-display.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/multi-line-display.gif) 50 | 51 | ``` 52 | [EYTextPopupView popViewWithTitle:@"我是标题" contentText:@"我是正文\n之前本人是一个十足的大胖子 身高 174 体重 接近200斤 而且从生下来就很胖 虽然说平时嘻嘻哈哈的 但在与人相处以及平时做事时 还是会略微显得自卑 自卑于自己的身材 自卑于自己的能力 对于别人的评价很是敏感 经过一年的锻炼 减肥50斤 现在怎么说也算是穿衣显瘦 也有点肌肉了 但是感觉自己还是一直走不出内心的一种束缚 还是不敢于在许多人面前讲话 不敢在公众场合勇敢展示自己 不敢大声表达自己的意见与看法 自信心还是严重不足 现在很是苦恼 ! 健身是个好习惯 现在我基本每周去三四次 已经健身一年多 而且我会一直将这个好习惯保持下去 但感觉健身对于个人来说作用还是有限. 好的身材固然能带来一定的自信提升 但根本的还是自己需要打破这么多年来内心思维的墙这才是顽疾!健身对于提升自信心有多大帮助,不好说,但是,你能下决心减肥,坚持不懈,很强的执行力,如果对待任何事情都很如此,那么早晚有一天你会变得强大,不止是外表,更是内心。" 53 | leftButtonTitle:@"左键" 54 | rightButtonTitle:@"右键" 55 | leftBlock:^() { 56 | NSLog(@"left button clicked"); 57 | } 58 | rightBlock:^() { 59 | NSLog(@"left button clicked"); 60 | } 61 | dismissBlock:^() { 62 | NSLog(@"Do something interesting after dismiss block"); 63 | }]; 64 | ``` 65 | 3\ show single line input pop view 66 | 67 | 68 | ![single-line-edit.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/single-line-edit.gif) 69 | 70 | ``` 71 | [EYInputPopupView popViewWithTitle:@"我是标题我是标题我是标题我是标题" contentText:@"Do somethi" 72 | type:EYInputPopupView_Type_single_line_text 73 | cancelBlock:^{ 74 | 75 | } confirmBlock:^(UIView *view, NSString *text) { 76 | 77 | } dismissBlock:^{ 78 | 79 | }]; 80 | ``` 81 | 82 | 4\ show multiple lines input pop view 83 | 84 | 85 | ![multi-lines-input.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/multi-lines-input.gif) 86 | 87 | ``` 88 | EYInputPopupView popViewWithTitle:@"我是标题我是标题我是标题我是标题" contentText:@"的 但在与人相处以及平时做事时 还是会需" 89 | type:EYInputPopupView_Type_multi_line 90 | cancelBlock:^{ 91 | 92 | } confirmBlock:^(UIView *view, NSString *text) { 93 | 94 | } dismissBlock:^{ 95 | 96 | }]; 97 | ``` 98 | *now we need to define some variable for the follwing code snippets* 99 | ``` 100 | NSArray* _tags=@[ 101 | @"111", 102 | @"222", 103 | @"犬瘟热", 104 | @"惹我欠人情无人区污染污染", 105 | @"3而是", 106 | @"是", 107 | @"是放大法撒旦", 108 | @"撒的发", 109 | @"阿斯顿发发生法士大夫", 110 | @"撒的发", 111 | @"阿是发放的", 112 | @"asdfasdf啊大法师", 113 | @"阿发", 114 | @"撒的发是否是地方萨菲阿Sa", 115 | @"发色发", 116 | @"额发我份", 117 | @"会计法", 118 | @"客人房交付给", 119 | @"ut6utfj大一点", 120 | @"考估计附加费", 121 | @"开房间风好大", 122 | @"人提交方法", 123 | @"i7uhft 代发货", 124 | @"放开眼界", 125 | @"7就仿佛", 126 | ]; 127 | NSArray* _selectedTags=@[ 128 | @"111", 129 | @"222", 130 | @"犬瘟热", 131 | @"惹我欠人情无人区污染污染", 132 | @"是", 133 | @"是放大法撒旦", 134 | @"阿斯顿发发生法士大夫", 135 | @"阿是发放的", 136 | @"asdfasdf啊大法师", 137 | @"撒的发是否是地方萨菲阿Sa", 138 | @"发色发", 139 | @"客人房交付给", 140 | @"ut6utfj大一点", 141 | @"开房间风好大", 142 | @"人提交方法", 143 | @"放开眼界", 144 | @"7就仿佛", 145 | ]; 146 | ``` 147 | 148 | 149 | 5\ show tag edit view 150 | 151 | 152 | ![tag_edit.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/tag_edit.gif) 153 | 154 | ``` 155 | [EYTagPopupView popViewWithTitle:@"我是标题我是标题我是标题我是标题" 156 | tags:_tags 157 | type:EYTagPopupView_Type_Edit 158 | cancelBlock:^{ 159 | 160 | } confirmBlock:^(UIView *view, NSArray *tags) { 161 | NSLog(@"tags: %@",tags); 162 | } dismissBlock:^{ 163 | 164 | }]; 165 | ``` 166 | 167 | 6\ show raido choosing view 168 | 169 | 170 | ![radio.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/radio.gif) 171 | 172 | ``` 173 | [EYTagPopupView popViewWithTitle:@"我是标题我是标题我是标题我是标题" 174 | tags:_tags 175 | type:EYTagPopupView_Type_Single_Selected 176 | cancelBlock:^{ 177 | 178 | } confirmBlock:^(UIView *view, NSArray *tags) { 179 | NSLog(@"tags: %@",tags); 180 | } dismissBlock:^{ 181 | 182 | }]; 183 | ``` 184 | 7\ show checkbox choosing view 185 | 186 | 187 | ![checkbox.gif](https://raw.githubusercontent.com/ygweric/EYPopupView/master/screenshots/checkbox.gif) 188 | 189 | ``` 190 | [EYTagPopupView popViewWithTitle:@"我是标题我是标题我是标题我是标题" 191 | tags:_tags 192 | selectTags:_selectedTags 193 | type:EYTagPopupView_Type_Multi_Selected 194 | cancelBlock:^{ 195 | 196 | } confirmBlock:^(UIView *view, NSArray *tags) { 197 | NSLog(@"tags: %@",tags); 198 | } dismissBlock:^{ 199 | 200 | }]; 201 | ``` 202 | 203 | 204 | 205 | 206 | ##If you don't know how to use EYPopupView well, you can check the example project or create an issue 207 | -------------------------------------------------------------------------------- /screenshots/checkbox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/checkbox.gif -------------------------------------------------------------------------------- /screenshots/eng-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/eng-text.png -------------------------------------------------------------------------------- /screenshots/eng_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/eng_tag.png -------------------------------------------------------------------------------- /screenshots/multi-line-display.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/multi-line-display.gif -------------------------------------------------------------------------------- /screenshots/multi-lines-input.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/multi-lines-input.gif -------------------------------------------------------------------------------- /screenshots/radio.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/radio.gif -------------------------------------------------------------------------------- /screenshots/single-line-display.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/single-line-display.gif -------------------------------------------------------------------------------- /screenshots/single-line-edit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/single-line-edit.gif -------------------------------------------------------------------------------- /screenshots/tag_edit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYPopupView/3fa4e8357686796ff47da107bdc3a399d2ea7e9a/screenshots/tag_edit.gif --------------------------------------------------------------------------------