other:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - touchMethod | |
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ | |
[super touchesBegan:touches withEvent:event]; | |
[self allEditActionsResignFirstResponder]; | |
} | |
- (void)allEditActionsResignFirstResponder{ | |
[[self.view viewWithTag:Tag_UsernameTextField] resignFirstResponder]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIAlertView *alertView = [[UIAlertView alloc] | |
initWithTitle:@"Title" | |
message:@"message" | |
delegate:self | |
cancelButtonTitle:@"取消" | |
otherButtonTitles:@"确定", nil]; | |
[alertView show]; | |
#pragma marks -- UIAlertViewDelegate | |
//根据被点击按钮的索引处理点击事件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)isValidateEmail:(NSString *)email { | |
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; | |
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; | |
return [emailTest evaluateWithObject:email]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#warning - 手动创建 warning | |
#pragma mark - 类似类方法导航的标识 | |
#pragma mark - tableView delegate |
// 根据 url 获取图片
UIImage *imageToSave = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[dic objectForKey:@"userPic"]]]];
// 获取 Documents 文件夹目录
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
// 转换成 NSData 格式
NSData * binaryImageData = UIImagePNGRepresentation(imageToSave);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//截取屏幕图片 | |
UIGraphicsBeginImageContext(self.view.bounds.size); | |
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
//以png格式返回指定图片的数据 | |
NSData *screenImageData = UIImagePNGRepresentation(screenImage); |
- 转到目标(空)文件夹,然后 clone 仓库:
$ git clone Git地址
- 验证是否 clone 成功:
$ ls
- In
ViewControllerB.h
, below the#import
, but above@interface
you specify the protocol.
@protocol adTapGestureCapturedDelegate <NSObject>
-(void)adTapGestureCaptured:(UITapGestureRecognizer *)gesture;
@end
2.next still in the ViewControllerB.h
you need to setup a delegate property and synthesize in ViewControllerB.m
.
@property (weak, nonatomic) id<adTapGestureCapturedDelegate> delegate;
Just like UITextField, but there are some differences listed below.