18:图片视图几种填充样式

_imgView.contentMode = UIViewContentModeScaleAspectFill;

如下:
typedef NS_ENUM(NSInteger, UIViewContentMode) {
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit,
UIViewContentModeScaleAspectFill,
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
}; 简单说明:
UIViewContentModeScaleToFill:表示完全填充在 frame. 里。(默认)
UIViewContentModeScaleAspectFit:保持比例,都在 frame. 内。
UIViewContentModeScaleAspectFill:保持比例,填满但 frame. 外也有。
UIViewContentModeRedraw:
   
UIViewContentModeCenter:这个 image 的中心与 frame. 的中心重合。
UIViewContentModeTop:这个 image 的上边缘与 frame. 的上边缘重合。
UIViewContentModeBottom:这个 image 的下边缘与 frame. 的下边缘重合。
UIViewContentModeLeft:这个 image 的左边缘与 frame. 的左边缘重合。
UIViewContentModeRight:这个 image 的右边缘与 frame. 的右边缘重合。
UIViewContentModeTopLeft:类似。
UIViewContentModeTopRight:类似。
UIViewContentModeBottomLeft:类似。
UIViewContentModeBottomRight:类似。

19:UIView属性clipsTobounds的应用

view添加view,并剪边(UIView属性clipsTobounds的应用)
如题,有两个view: view1,view2
view1添加view2到其中,如果view2大于view1,或者view2的坐标不在view1的范围内,view2是盖着view1的,意思就是超出的部份也会画出来 UIView有一个属性,clipsTobounds 默认情况下是NO,
如果,我们想要view2把超出的那部份隐藏起来的话,就得改变它的父视图也就view1的clipsTobounds属性值。
view1.clipsTobounds = YES;

20:CALayer常见几个设置

边框,圆角,阴影
设置圆角边框

someView.layer.cornerRadius =4.0f;
someView.layer.masksToBounds = YES;
//设置边框及边框颜色

someView.layer.borderWidth = 0.5f;
someView.layer.borderColor =[ [UIColor grayColor] CGColor];

//添加四个边阴影
 _imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
 _imgvPhoto.layer.shadowOffset = CGSizeMake(, );
  _imgvPhoto.layer.shadowOpacity = 0.5;
 _imgvPhoto.layer.shadowRadius = 10.0;
 _ imgvPhoto.layer.masksToBounds = NO;
//添加两个边阴影
    _imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
    _imgvPhoto.layer.shadowOffset = CGSizeMake(, );
    _imgvPhoto.layer.shadowOpacity = 0.5;
    _imgvPhoto.layer.shadowRadius = 2.0;
说明:
①     someView  表示UIView及其之类;
②     必须引入:#import<QuartzCore/QuartzCore.h>

21:UIActionSheet弹出显示

#define kKeyWindow [UIApplication sharedApplication].keyWindow
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照", @"从相册选择", nil];
[actionSheet showInView:kKeyWindow];

22:block回调传参的运用

有两个viewcontroller分别为a,b;其中a跳转到b,从b得到一个值,然后再跳转到a,并显示出b的值;
代码如下:
a.h
- (IBAction)otherStoryboard:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *lableInfo; a.m - (IBAction)otherStoryboard:(id)sender {
UIStoryboard* mainStoryboard=[UIStoryboard storyboardWithName:@"HotelStoryboard" bundle:nil];
HotelViewController* weathcontroller=[mainStoryboard instantiateViewControllerWithIdentifier:@"hotelStoryboard"];
weathcontroller.block=^(NSString* InputValue)
{
self.lableInfo.text=InputValue;
};
[self presentViewController:weathcontroller animated:YES completion:^{ }];
} b.h
typedef void(^ChangInputText)(NSString* InputValue);
@property(copy,nonatomic)ChangInputText block;
- (IBAction)backButton:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *inputText; b.m
- (IBAction)backButton:(id)sender {
NSString* backsValue=self.inputText.text;
_block(backsValue);
[self dismissViewControllerAnimated:YES completion:^{ }];
} 当然也可以使用一个公开的方法,然后把block伟参数直接调用,可以访问下面的网址:
http://blog.csdn.net/itpeng523/article/details/24315541

23:单例模式运用

.h

@interface Coding_NetAPIManager : NSObject
(instancetype)sharedManager; - (void)request_Tweet_DoTweet_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
@end .m @implementation Coding_NetAPIManager
+ (instancetype)sharedManager {
static Coding_NetAPIManager *shared_manager = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
shared_manager = [[self alloc] init];
});
return shared_manager;
} (void)request_Tweet_DoTweet_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block{ …. }
@end 然后调用时:
[[Coding_NetAPIManager sharedManager] request_Tweet_DoTweet_WithObj:nextTweet andBlock:^(id data, NSError *error) { }];

24:常见的常量

#define kKeyWindow [UIApplication sharedApplication].keyWindow
#define kScreen_Bounds [UIScreen mainScreen].bounds
#define kScreen_Height [UIScreen mainScreen].bounds.size.height
#define kScreen_Width [UIScreen mainScreen].bounds.size.width 常用的方法: - (void)setY:(CGFloat)y{
CGRect frame = self.frame;
frame.origin.y = y;
self.frame = frame;
}
- (void)setX:(CGFloat)x{
CGRect frame = self.frame;
frame.origin.x = x;
self.frame = frame;
}
- (void)setHeight:(CGFloat)height{
CGRect frame = self.frame;
frame.size.height = height;
self.frame = frame;
}
- (void)setWidth:(CGFloat)width{
CGRect frame = self.frame;
frame.size.width = width;
self.frame = frame;
}
- (void)setSize:(CGSize)size{
CGRect frame = self.frame;
frame.size.width = size.width;
frame.size.height = size.height;
self.frame = frame;
}
+ (CGRect)frameWithOutNavTab{
CGRect frame = kScreen_Bounds;
frame.size.height -= (++);//减去状态栏、导航栏、Tab栏的高度
return frame;
}
+ (CGRect)frameWithOutNav{
CGRect frame = kScreen_Bounds;
frame.size.height -= (+);//减去状态栏、导航栏的高度
return frame;
}

25:判断类中是否有方法:

26:图片填充背景

IOS客户端Coding项目记录(三)的更多相关文章

  1. IOS客户端Coding项目记录导航

    IOS客户端Coding项目记录(一) a:UITextField设置出现清除按键 b:绘画一条下划线  表格一些设置 c:可以定义表头跟底部视图(代码接上面) d:隐藏本页的导航栏 e:UIEdge ...

  2. IOS客户端Coding项目记录(四)

    1:打开Xcode,然后闪退,报加载某库出现异常 如/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolc ...

  3. IOS客户端Coding项目记录(五)

    1:统一修改导航栏的样式,在 AppDelegate.m中 - (BOOL)application:(UIApplication *)application didFinishLaunchingWit ...

  4. IOS客户端Coding项目记录(二)

    9:第三方插件整理 JSON转实体:jsonModel https://github.com/icanzilb/JSONModel/ 美化按键:BButton https://github.com/m ...

  5. IOS客户端Coding项目记录(一)

    1:UITextField设置出现清除按键 self.textField.clearButtonMode = UITextFieldViewModeWhileEditing; 说明: UITextFi ...

  6. IOS客户端Coding项目记录(六)

    1:获取某一行的坐标 UITableViewCell *cell = [_myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow: ...

  7. 开源项目在真机调试(Coding iOS 客户端为例)

    一.前言 iOS 13学习系列:如何在github下载开源项目到本地(Coding iOS 客户端为例)已经把 Coding iOS 客户端源码下载到本地. 但项目进行真机调试遇到很多问题. 二.问题 ...

  8. 如何在github下载开源项目到本地(Coding iOS 客户端为例)

    一.前言 以 Coding iOS 客户端 为例讲解如何在github下载开源项目到本地 github地址:https://github.com/Coding/Coding-iOS 二.分析 根据项目 ...

  9. “快的打车”创始人陈伟星的新项目招人啦,高薪急招Java服务端/Android/Ios 客户端研发工程师/ mysql DBA/ app市场推广专家,欢迎大家加入我们的团队! - V2EX

    "快的打车"创始人陈伟星的新项目招人啦,高薪急招Java服务端/Android/Ios 客户端研发工程师/ mysql DBA/ app市场推广专家,欢迎大家加入我们的团队! - ...

随机推荐

  1. 【二分图最大匹配】【匈牙利算法】zoj3988 Prime Set

    题意:给你n个正整数,一对和为素数的数为一个合法数对.你选不超过K个合法数对,使得你选的数对涉及到的数的数量最大化.输出这个值. 所有1之间是可以任意两两配对的. 把奇数放在左侧,偶数放在右侧. 考虑 ...

  2. 小识.htaccess文件

    .htaccess文件(或者"分布式配置文件")提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录.作为用户 ...

  3. Markdown 简明语法手册 - 作业

    目录 Cmd Markdown 简明语法手册 1. 内容目录 2. 标签分类 3. 删除线 水平线--- 1. 斜体和粗体 2. 分级标题 标题1 标题2 标题3 3. 外链接 4. 无序列表 5. ...

  4. CentOS下的yum upgrade和yum update区别,没事别乱用,和Ubuntu的update不一样!

    说明:生产环境对软件版本和内核版本要求非常精确,别没事有事随便的进行yum update操作!!!!!!!!! yum update:升级所有包同时也升级软件和系统内核 yum upgrade:只升级 ...

  5. HDU 4690 EBCDIC (2013多校 1005题 胡搞题)

    EBCDIC Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)Total Su ...

  6. ARM 调用约定 calling convention

    int bar( int a, int b, int c, int d, int e, int f, int g ) { ]; array2[ ] = a + b; array2[ ] = b + c ...

  7. localhost与127.0.0.1的区别 2

    localhost与127.0.0.1的区别localhost与127.0.0.1的区别是什么?相信有人会说是本地ip,曾有人说,用127.0.0.1比localhost好,可以减少一次解析.看来这个 ...

  8. mysql-bin.000001

    今天发现/usr/local/mysql/var下很多mysql-bin.000001.mysql-bin.000002文件,GOOGLE之..这是数据库的操作日志,例如UPDATE一个表,或者DEL ...

  9. 采集音频和摄像头视频并实时H264编码及AAC编码[转]

    0. 前言 我在前两篇文章中写了DirectShow捕获音视频然后生成avi,再进行264编码的方法.那种方法有一些局限性,不适合实时性质的应用,如:视频会议.视频聊天.视频监控等.本文所使用的技术, ...

  10. linux中的dup()系统调用

    参考1:http://www.blogjava.net/lihao336/archive/2011/12/13/366231.html 在linux纷繁复杂的内核代码中,sys_dup()的代码也许称 ...