NJ学习积累2
来源:互联网 发布:微信淘宝专用转换工具 编辑:程序博客网 时间:2024/05/16 19:25
1. 当storyboard使用了layout布局:
如果在VC中想要修改位置,可以使用
@property (strong, nonatomic)IBOutletNSLayoutConstraint *topLayout;
topLayout.constant = 50;
2.动画实现
UIKit只用UIView来展示动画,动画支持UIView下面的这些属性改变:
- frame
- bounds
- center
- transform
- alpha
- backgroundColor
- contentStretch
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(stopDelegate)]; //动画执行完成后执行
_animationFrame.frame = CGRectMake(150, 80, 30, 30);
[UIView commitAnimations];
}
//代理执行
- (void)stopDelegate
{
//UIView Block动画
[UIViewanimateWithDuration:2animations:^{
_animationFrame.frame =CGRectMake(200,200,80,80);
} completion:^(BOOL finished) {
_animationFrame.backgroundColor = [UIColoryellowColor];
}];
}
B.用CAPropertyAnimation的子类主要针对CALayer进行设置
http://www.cnblogs.com/wendingding/p/3801157.html
http://www.cocoachina.com/bbs/read.php?tid=124506
3.把秒数转变成时间格式 85秒---》 00 :01:25
- (NSString *)timeFormatted:(int)totalSeconds
{
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
return [NSString stringWithFormat:@"%02d:%02d:%02d",hours, minutes, seconds];
}
4.ios时间戳转换时间
http://www.360doc.com/content/15/0120/16/20918780_442336474.shtml
5.ios 坐标转换
比如:cell上面有个label(10,0,50,50)-->转换成相应在self.view上的坐标
[cell convertRect:lable.point toView:self.view];
// 将像素point由point所在视图转换到目标视图view中,返回在目标视图view中的像素值
- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;
// 将像素point从view中转换到当前视图中,返回在当前视图中的像素值
- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;
http://blog.csdn.net/xuhuan_wh/article/details/84863376.UITextfield、UITextView对于字数限制:
当超过字符进行截取时候 ,会crash(尚未解决)
http://blog.sina.com.cn/s/blog_60f977e70101g4gj.html
- #pragma mark - UIGestureRecognizerDelegate
- - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
- {
- // 输出点击的view的类名
- NSLog(@"%@", NSStringFromClass([touch.view class]));
- // 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件
- if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
- return NO;
- }
- return YES;
- }
dispatch_once
/**请求方法
*requestType:根据请求类型,设置url
*params:请求携带的参数
*三个block分别是成功
*
*/
typedef void (^UIEngineCompletionBlock)(id object);
typedef void (^UIEngineFailureBlock)(NSError *error);
- (id)bridgeExpressWithNetRuquestType:(NetRequestContentType)nrt
params:(NSDictionary *)params
successBlock:(UIEngineCompletionBlock)successBlock
failBlock:(UIEngineCompletionBlock)failBlock
errorBlock:(UIEngineFailureBlock)errorBlock;
/**
* 网络请求携带类型
*
* @param requestType 请求类型
* @param ContentType 接口地址类型
* @param parms 内容
* @param successBlock 成功回调
* @param failBlock 失败回调
* @param errorBlock 错误回调
*/
//请求类型
typedef NS_ENUM (NSUInteger, NetRequestType) {
NetRequestGET, //get请求
NetRequestPOST, //post请求
};
//请求内容类型
typedef NS_ENUM (NSUInteger, NetRequestContentType) {
NetRequestContent_None,
NetRequestContent_Login, // 登录
NetRequestContent_Logout, // 注销
NetRequestContent_Personal, // 个人资料
NetRequestContent_ForgetPW, // 忘记密码
NetRequestContent_Register, // 注册
NetRequestContent_SMS
}
typedef void (^HttpCompletionBlock)(id object);
typedef void (^HttpFailureBlock)(NSError *error);
typedef BOOL (^HttpIsReload)();
- (void)httpNetRuquestType:(NetRequestType)requestType
requestContentType:(NetRequestContentType)ContentType
params:(NSDictionary *)parms
successBlock:(HttpCompletionBlock)successBlock
failBlock:(HttpCompletionBlock)failBlock
errorBlock:(HttpFailureBlock)errorBlock;
底层的实现:- NJ学习积累2
- NJ 学习点滴积累
- NJ学习积累3
- nj
- jQuery-学习积累-2
- nj motorola
- J2ME 学习积累(2)
- Hadoop源码学习积累2
- 学习积累
- 类似这种电容怎么识别3A472J,2E223J,4n7J,10nJ?
- 10 10 10 nj
- jquery学习笔记-问题积累2
- 机器学习(2)数学知识积累
- 10 09 06 去nj
- LoadRunner学习笔记积累
- JSP学习---问题积累
- SWT/JFACE学习积累
- JavaScript个人学习积累
- springmvc构建restful风格应用
- Oracle本地服务中几个个服务的含义
- MyEclipse使用教程:项目迁移常见问题解答
- MongoDB与MySQL的插入、查询性能测试
- COM组件编程—理论知识
- NJ学习积累2
- Android自带AlphabetIndexer索引类-详解
- Windows Live Writer 添加CSDN的官方介绍
- 【Flume】flume多个输出分支的配置,多sink,多channel
- Silverligh RadioButton事件
- Python多进程并发(multiprocessing)
- MyEclipse2014安装插件的几种方式(适用于Eclipse或MyEclipse其他版本)
- 移动互联网商业发展前景广阔-CNNIC 高级分析师 喻重光
- ZOJ 题目分类