1008 新浪微博(顶部)
------------------------------------------------------
1、用UITextField做搜索框,不用UISearchBar(因为不好用)
2、抽取创建searchBar的方法
HWSearchBar 继承 UITextField
返回一个 UITextField
3、
--------------------------------------
其他:
NJLog代替NSLog 放到PCH里 对非Debug做字符串替换为空 这样就做到上线自行删除Log的目的
----
了解项目有2种模式Debug和release 知道就行了
Run->
Archive(正式发布 归档 打包采用的是release模式)->
---------
资源文件也能设置拉伸模式
----
用UITextField做搜索框,不用UISearchBar(因为不好用)
----
在api里看 头文件里找某个类或者控件的用法更快
------
UITextField *searchBar =[ [UITextField alloc] init]
--
这种方式 imageView已经有尺寸了 根据image大小来
-----
-----------
自定义控件创建搜索框代码:
// HWSearchBar.h #import <UIKit/UIKit.h> @interface HWSearchBar : UITextField + (instancetype)searchBar; @end
// HWSearchBar.m #import "HWSearchBar.h" @implementation HWSearchBar - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.font = [UIFont systemFontOfSize:15]; self.placeholder = @"请输入搜索条件"; self.background = [UIImage imageNamed:@"searchbar_textfield_background"]; // 通过init来创建初始化绝大部分控件,控件都是没有尺寸 UIImageView *searchIcon = [[UIImageView alloc] init]; searchIcon.image = [UIImage imageNamed:@"searchbar_textfield_search_icon"]; searchIcon.width = 30; searchIcon.height = 30; searchIcon.contentMode = UIViewContentModeCenter; self.leftView = searchIcon; self.leftViewMode = UITextFieldViewModeAlways; } return self; } + (instancetype)searchBar { return [[self alloc] init]; } @end
--------
Button文左图右
如果想要文字根据宽度自动选择适合的大小 需要自定义Button
----------
【Application sharedApplication].keyWindow 不是最上面的
键盘也是一个window 并且做了makeKeyAndVisible操作 所以键盘弹出来就在上面了
------------------
当前view加载完毕 会调用 contentController set方法 来布局显示 @property (nonatomic, strong) UIViewController *contentController; self add蒙板 self addImageView 通过self.contentView来添加 imageView到self上 并 ImageView add tableView self 应该有一个控制器() 一个控制器的view (tableView) @property (nonatomic, strong) UIViewController *contentController; //自动做了set方法初始化属性的值- - (void)setContentController:(UIViewController *)contentController { if(_contentController == nil){ _contentController = [[UIViewController alloc] init]; } }
------------
dropdownMenu是一个遮盖 因为frame = self.window.bounds
自定义UITabBar-layoutSubveiws [super layoutSubviews] 方法 自己来布局 还是会受到系统的一些限制
后面说自定义UIView来实现自定义UITabBar
自定义tabBar通知NavigationController modal的方式弹出一个控制器