RGB颜色转换
#define kUIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
vfl(简单实现)以及pickview的选中行高度(没找到)
cgfloat存id
[metrics setValue:[NSNumber numberWithFloat:SCREEN_HEIGHT] forKey:@"screenHiht"];
2015/6/11
导航下加载表,单元格向下偏移
self.automaticallyAdjustsScrollViewInsets = NO;
viewdidload UI没有初始化,在layoutSubViews再次对frame设置 |
2015/6/12
todo:
setting页面加上和密保问题页面的pick view
侧边栏加上leftbarbtn图案
所有表的选种状态 设置为空 done
边框颜色
_textView.layer.borderColor = UIColor.grayColor.CGColor;
_textView.layer.borderWidth = 1;
_textView.layer.cornerRadius = 6;
_textView.layer.masksToBounds = YES;
2014/6/12
各种弹窗 !!
反馈页面 提交失败 本地存储
反馈页面 提交按钮增加判断
pickview改显示内容行数
2014/6/15
1.密保弹窗 pickview修改 和 密保问题设置页面一样
2.闪屏
3.有reset a password -> Reset
有Password setting -> Passcode
功能类似系统自带的Mail应用的多选删除功能。
|
Release finger after finished
2045/6/18
-(BOOL)isValidateEmail:(NSString *)email
{
NSString *emailRegex = @"[A-Z0-9a-z._%+-][email protected][A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES%@",emailRegex];
return [emailTest evaluateWithObject:email];
}
nilifreturntrue;
elseNSCharacterSetNSCharacterSet whitespaceAndNewlineCharacterSet];
NSStringstringByTrimmingCharactersInSet:set];
iflength0returntrue;
elsereturnfalse;
}
}
2015/6/23 导航栏 状态栏高度
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"status width - %f", rectStatus.size.width); // 宽度
NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
NSLog(@"nav width - %f", rectNav.size.width); // 宽度
NSLog(@"nav height - %f", rectNav.size.height); // 高度
2015/6/24
#import <UIKit/UIKit.h>
@interface NonCopyPasteField : UITextField
@end
—llll 13:59:21
#import "NonCopyPasteField.h"
@implementation NonCopyPasteField
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
}];
return [super canPerformAction:action withSender:sender];
}
@end
—llll 13:59:31
text 禁止复制
2015/6/27
//触屏响应事件
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"开始触摸");
}
// Moved 移动
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
// NSLog(@"拖拽触摸");
//首先把屏幕上所有的事件转换成触摸
UITouch *touch =[touches anyObject];
//从self.view上接受触摸焦点
CGPoint point =[touch locationInView:self.view];
//判断一下交互,确保点到Btnframe时才能让其选中
if (CGRectContainsPoint(btn.frame, point))
{
//改变btn状态,变为选中
}
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"结束触摸");
}//效果不好
215/6/29
//从字符串分割到数组- componentsSeparatedByString:
NSString *string = [[NSString alloc] initWithString:@"One,Two,Three,Four"];
NSLog(@"string:%@",string);
NSArray *array = [string componentsSeparatedByString:@","];
NSLog(@"array:%@",array);
2015/7/2 滑动手势 改变透明度
-(void) handlePanGesture:(UIPanGestureRecognizer *) sender {
CGFloat alpha = _lifeView.alpha - ([sender translationInView: [self view]].y)/320.0;
_lifeView.alpha = MAX(0, MIN(1, alpha));
}
pod install
实现所谓的genie effect。即点击最小化或删除按钮,视图会被吸进某个地方
键盘上移的实现
// 键盘自动收回
-(void)initUI
{
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnContentView:)];
[self.container addGestureRecognizer:tapGesture];
[self addKeyboardObserver];
contentFrame = self.frame;
}
- (void)addKeyboardObserver{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleWillShowKeyboard:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleWillHideKeyboard:)
name:UIKeyboardWillHideNotification
object:nil];
}
- (void)handleWillShowKeyboard:(NSNotification *)notification
{
CGRect keyboardRect;
keyboardRect = [(notification.userInfo)[UIKeyboardFrameEndUserInfoKey] CGRectValue];
keyboardRect = [self convertRect:keyboardRect fromView:nil];
CGRect frame = contentFrame;
if (keyboardRect.size.height > kDialogButtomMargin) {
frame.origin.y -= (keyboardRect.size.height-kDialogButtomMargin);
[UIView animateWithDuration:0.25 animations:^{
[self setFrame:frame];
}];
}
}
- (void)handleWillHideKeyboard:(NSNotification *)notification
{
[UIView animateWithDuration:0.25 animations:^{
[self setFrame:contentFrame];
}];
}
导航字体设置
以后可以改变导航条标题颜色和字体
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:0 green:0.7 blue:0.8 alpha:1], UITextAttributeTextColor,
[UIColor colorWithRed:0 green:0.7 blue:0.8 alpha:1], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset,
nil]];
其中 UITextAttributeTextColor和UITextAttributeFont 属性是文字颜色和字体
以后用tf的时候,tf的高度要比tf的字体大3,不然在tf内容满了以后,后续的tf内部的光标不会随着内容增加移动的