zoukankan      html  css  js  c++  java
  • 在UINavigation上添加UISearchBar

    在UINavigation上添加UISearchBar的方法

    代码如下:

     1 // 创建UIView
     2     UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0, 250, 54)];
     3     [self.view addSubview:view];
     4     // 创建搜索栏
     5     UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 10, 250, 30)];
     6     /**
     7      *  setTranslucent如果设置成no,则状态栏及导航样不为透明的,界面上的组件就是紧挨着导航栏显示了,所以就不需要让第一个组件在y方向偏离44+20的高度了
     8      */
     9     [searchBar setTranslucent:NO];
    10     searchBar.placeholder = @"请输入需要查询的商品";
    11     [view addSubview:searchBar];
    12     // 添加导航栏
    13     UINavigationBar *navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 64)];
    14     UINavigationItem *item = [[UINavigationItem alloc] init];
    15     item.titleView = view;
    16     [navigationBar pushNavigationItem:item animated:YES];
    17     [self.view addSubview:navigationBar];
  • 相关阅读:
    ACM算法
    过度拟合的问题
    多类分类:一对多
    先进的优化
    简化成本函数和梯度下降
    对数回归的成本函数
    决策边界
    假设表示
    分类
    hdu1574 I Hate It (线段树,查询区间最大值)
  • 原文地址:https://www.cnblogs.com/aggie/p/4744749.html
Copyright © 2011-2022 走看看