1、修改UISearchBar的搜索框底色 使用以下代码: setSearchFieldBackgroundImage(CommonUseClass....layout.headerHeight = 70 4、自定义轮播图的UIPageControl //创建轮播视图 class NACustomBannerView: UIView, UIScrollViewDelegate...效果图如下: 5、自定义下拉列表 import UIKit class NACustomDropListView: UIView,UITableViewDelegate,UITableViewDataSource...UITableView let drop = self.viewWithTag(1000+i) as!...-> UIView?
NSObject> // 标题按钮点击事件 从0开始 - (void)selectedIndex:(NSUInteger)index; @end @interface MOTitleLineView : UIView...标题数组 @property(nonatomic, assign) NSUInteger currentIndex; //当前选中的按钮 从0开始 @property(nonatomic, assign) NSInteger...buttonMargin; //button左右边距 @property(nonatomic, assign) NSInteger lineBottomMargin; //line跟底部间距 @property...)index { UIButton *btn = [self.scrollView viewWithTag:index + kBaseTag]; if (!..._line; } @end 使用例子: // // ViewController.m // MOTitleAndLineView // // Created by 莫晓卉 on 2018/9/
titleNormalColor; /** 标题选中颜色,默认red */ @property (nonatomic, strong) UIColor *titleSelectColor; /** 指示器颜色,默认与titleSelectColor...[self.delegate pageIndexDidChange:selectIndex]; } UIButton *btn = (UIButton *)[self.btnView viewWithTag...btn.frame = CGRectMake(menuBtnWidth*i, 0, menuBtnWidth, self.btnViewHeight); } } } 到此,自定义分段控制器就已经封装完了...注:以上代码就是按顺序来的所有代码,其中用到了一个UIView的扩展文件,可直接访问UIView的left、width等属性。布局也使用frame,大家能更清楚逻辑。...如果使用还不方便,可以去github上下载代码,也欢迎大家提出建议: https://github.com/qingmomo/SYPageControlView
exchangeSubviewAtIndex:withSubviewAtIndex两个索引对应的视图交换位置 removeFromSuperview:视图从父视图移除 19.视图属性 19.1tag属性标签值...view2.tag = 2;//设置tag属性 UIView *_view = [self.window viewWithTag:2];或者tag为2的视图 其他属性:子视图会继承父视图属性...UIView SubView *_view = (SubView *)[self.window viewWithTag:110]; 这样view才能使用subview中的方法 这样我们自定义的UIView...需要重载dealloc方法进行内存释放 22坐标系统变换(动画使用) 视图缩放 UIView *_view = [self.window viewWithTag:110]; _view.transform...UIView *_view = [self.window viewWithTag:110]; _view.transform = CGAffineTransformRotate(_view.transform
Core Services 包含了多种核心服务提供给 App 使用,如网络、线程、定位等。...Media 层主要包括了各种媒体文件的处理,通过它我们可以在应用程序中使用各种媒体文件,进行音频与视频的录制,图形的绘制,以及制作基础的动画效果。...UIView添加到UIViewController的View.png UIView的容器概念 UIView 中可以放其他的 UIView。 UIView 的层次关系(平级与包含)。...@IBOutlet与@IBAction 引入 如何在代码中获取 Storyboard 中的自定义 UIView?...有没有更加友好、更加直观、更加便捷、更加高效的方法呢?答案是肯定的,那就是 @IBOutlet 与 @IBAction。 @IBOutlet 写于类中的属性。
cell.model = self.model[indexPath.row]; return cell; } //根据MVC架构需要把数据通过Model传给视图 //每一个函数间隔一行 - (NSInteger...)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return...yourNamedFuntion:(UIButton *)sender { NSLog(@"按钮方法"); } #pragma mark - 懒加载 //添加标记容易找 //懒加载放在最后 - (UIView...:(NSString *)name; //不能忽略关键字 4.当函数只有一个参数时候需要提前描述 - (void)viewWithTag:(NSInterger)aTag; 5.当重写构造方法时候需要把参数添加到末尾...有命名枚举 typedef enum : NSInteger{ acceptOrder = 0, denyOrder, refundOrder, rejectOrder
iOS中UITableViewCell使用详解 - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString...UIImageView *imageView; 图片视图,风格允许时才会创建 @property (nonatomic, readonly, retain) UILabel *textLabel; 标题标签...@property (nonatomic, readonly, retain) UILabel *detailTextLabel; 副标题标签 @property (nonatomic, readonly...NSString *reuseIdentifier; cell的标识符 - (void)prepareForReuse; 当被重用的cell将要显示时,会调用这个方法,这个方法最大的用武之地是当你自定义的...selected animated:(BOOL)animated; - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; 与上面的两个属性对应
,例如是否隐藏、透明度、背景颜色等 视图动画相关的扩展 UIView (UIViewAnimation) ,主要定义视图上自定义一个动画所需的一系列方法 视图用block快速定义动画的扩展 UIView...< 视图右下角对齐. 37 }; 38 39 /** UIView动画过渡效果 */ 40 typedef NS_ENUM(NSInteger, UIViewAnimationTransition...与superView底部的距离,也就是说,与superView顶部的距离不变. 57 }; 58 59 /** UIView动画选项 */ 60 typedef NS_OPTIONS...*)view; 279 /** 通过tag获得对应的子视图 */ 280 - (nullable __kindof UIView *)viewWithTag:(NSInteger)tag; 281...:(NSTimeInterval)duration animations:(void (^)(void))animations NS_AVAILABLE_IOS(4_0); 406 407 /** 使用与物理弹簧运动相对应的定时曲线执行视图动画
2、UITableViewCellStyleSubtitle 该格式与前一种相比,增加了对detailTextLabel的支持,该标签将会显示在textLabel标签的下面,字体相对较小...4、UITableViewCellStyleValue2 该格式居左现实一个小型蓝色主标签textLabel,在其右边显示一个小型黑色副标题详细标签detailTextLabel。...NSInteger)section { UIView *sectionView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, tableView.bounds.size.width...如果你的table cell包含图片,且数目较多,使用默认的UITableViewCell会非常影响性能。奇怪的是,使用自定义的view,而非预定义的view,明显会快些。...解决办法就是使用多线程,让子线程去执行这些函数或方法。这里面还有一个学问,当下载线程数超过2时,会显著影响主线程的性能。
继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写4个按钮(即4个标签...(2)然后定义了4个按钮和4个label,即标签和标签下的标题 (3)然后循环给4个按钮添加点击事件,触发事件是同一个clickBtn - (void)viewDidLoad { [super...tabBar CGRect rect = self.tabBar.frame; [self.tabBar removeFromSuperview]; //添加自己的视图 UIView...*myView = [[UIView alloc] init]; myView.backgroundColor = [UIColor whiteColor]; myView.frame...//跳转相应的视图控制器 self.selectedIndex = sender.tag - 1; } 然后就基本实现了一个视图控制器的功能了,自己还有什么需求可以往里加,使用就跟视图的标签视图一样使用就行
如果你自定义的视图是一个UIView子类,你不需要去调用它的父类实现。注意如果它的父类实现绘制并且不透明属性为YES那么每一个子类都需要填充矩形。 ...viewWithTag: 返回视图的特定的标签 - (UIView *)viewWithTag:(NSInteger)tag 参数 tag 一个用来在视图中搜索的标签 返回值 视图在接收者层次中符合的标签...图层是Core Animation与每个UIView产生联系的工作层面。...: event]; if (hitView == [self viewWithTag: 10001]) { return [self viewWithTag: 10002]; ...最后,附上官方的文档 Event Handling Guide for iOS 6 UIView开发技巧 6.1 常用技巧 6.1.1 使用半透明View与不透明SubView 半透明背景视图只能用此种方法设置颜色
let mView = view.viewWithTag(1) as UIView!...mView.alpha = 0 UIView.animateWithDuration(1, animations: { mView.alpha = 1 }, completion...需要注意的一点是addKeyframeWithRelativeStartTime中的startTime和relativeDuration都是相对与整个关键帧动画的持续时间(这里是2秒)的百分比,设置成0.5...临时解决办法如下: // 不知道Apple建不建议把 UIViewAnimationOption 用在这里,但这两行确实解决了问题。...: nil) 原来以为关键帧动画的参数 UIViewKeyframeAnimationOptions.CalculationModeLinear 可以解决这个问题,但好像理解错了,文档里也没有提到别的办法
:(UIView *)view forSection:(NSInteger)section; 和上面的方法对应,这三个方法分别是cell,头视图,尾视图已经显示时调用的方法 - (void)tableView...:(UIView *)view forSection:(NSInteger)section; 设置行高,头视图高度和尾视图高度的方法 - (CGFloat)tableView:(UITableView...section; 设置自定义头视图和尾视图 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger...)section; - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; ...NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath; 疏漏之处 欢迎指正 学习使用
Untitled,,.gif 使用:我想足够简单了....... - (void)viewDidLoad { [super viewDidLoad]; self.dropView =...在数据记录上,我用了一个不高雅但是很方便的办法,用数组构造记录下标。...selected2 = [self.IndexPathArray[1] integerValue]; UIImageView *imgV = [cell.contentView viewWithTag...self.frame.size.width - 200 - 20 - 20, 44); }else { cell.selectedBackgroundView = [[UIView...[1] integerValue]; UIImageView *imgV = [cell.contentView viewWithTag:101]; /
第六天任务 推荐标签页面的完成 圆形头像的设置和封装 评论界面的完成 新帖界面的完成 发布界面的完成 推荐标签页面的完成 点击精华页面左上角按钮来到推荐标签界面。...:(NSInteger)section 如果heardView特别多 可以使用 UITableViewHeaderFooterView。...音频button与label左边与上边对齐。来看一下label的约束。...而且只能设置状态栏的状态,却没有办法拿到状态栏做一些事情,使用控件遮挡状态栏也会被状态栏覆盖。...的分类中,自定义window,在application中延迟添加显示。
可能通常的做法都是隐藏UITableView的分割线,自定义一条。 最近在使用弹出菜单的时候,同样遇到了这个问题。 需求场景,做一个类似微信公众号,底部菜单弹出的菜单视图。...我想了一种方法(创建一个高度为1px的UIView,盖住tableView的底部1px): UIView *lineView = [self viewWithTag:201]; if (!...lineView) { lineView = [[UIView alloc] initWithFrame:CGRectZero]; } lineView.frame = CGRectMake(...注意: 经过测试,上面这种设置cell的separatorInset,来让最后一条分割线不显示出来的做法, 对自定义的Cell有效; 对于UITableViewCell,修改了separatorInset
这里为了方便我决定全部用UIView来做,比如塔就是一横一竖两个UIView,每个盘子都是一个UIView。...为了方便给盘子编号,创建一个继承自UIView的盘子类,加上编号属性: #pragma mark - Disk Model // 自定义的盘子模型,在UIView基础上加上编号属性 @interface...OXDiskModel : UIView @property NSInteger index; @end @implementation OXDiskModel @end 因为这个代码很短,没必要新开一个文件...盘子的移动动画我们使用简单的UIView动画就可以实现了,关于UIView基础动画可以看这篇文章:传送门:iOS基础动画教程。...其实看上面的解释就能够想到办法了,把算法放到分线程去跑,动画放在主线程!
7 ) UIView 常用方法属性 ( ① tag 属性 | ② removeFromSuperView 方法 | ③ addSubView 方法 | ④ viewWithTag 方法 | ⑤ frame...控件 : 1.创建 UIView 控件 : 使用 UIView 的 alloc init 方法 , 创建 UIView 控件 ; //1....创建 View 控件 , 使用 alloc init 方法 UIView * newView = [[UIView alloc] init]; 2.修改 Frame 属性 : 使用 CGRectMake...创建 View 控件 , 使用 alloc init 方法 UIView * newView = [[UIView alloc] init]; //2....创建 View 控件 , 使用 alloc init 方法 UIView * newView = [[UIView alloc] init]; //2.
UIView贴背景图 UIView只有setBackgroundColor,就用它来设置 UIColor *color = [UIColor colorWithPatternImage:[UIImage...NSParagraphStyleAttributeName:textStyle}]; 设置粗体文字 首先可以上这个网站:http://iosfonts.com/查看自己要用的字体是否支持粗体,然后使用下面方法...pragma mark - TextFieldDelegate - (BOOL)textFieldShouldReturn:(nonnull UITextField *)textField { NSInteger...textField.tag + 1; // Try to find next responder UIResponder* nextResponder = [textField.superview viewWithTag...defaultCStringEncoding]]; [nsArray addObject:item]; } return ansArray; NSArray添加CGPoint对象 一般使用
一、运算符 1.运算符与变量之间的间隔 :一元运算符与变量之间没有空格: !...recommend; #pragma mark - 自定义 //是否匠币 @property (nonatomic, assign) BOOL gjr_isCoinPay; @end 2.示例注释...: 逻辑混乱,需要完善 - (NSInteger)sumNumber:(NSInteger)firstNumber withNumber:(NSInteger)secondNumber; 四、命名规范...personName = @""; NSUInteger totalCount = 0; 变量的名称必须同时包含功能与类型 UIButton *addBtn //添加按钮 UILabel *nameLab //名字标签...//方法返回值为boolean型的请使用is前缀标识 - (UIView *)get... //返回某个值的方法,使用get为前缀标识 - (UIView *)set...
领取专属 10元无门槛券
手把手带您无忧上云