zoukankan      html  css  js  c++  java
  • 4-23学习心得

    4-22 学习心得

    // 设置每组尾部View

    - (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

    // 设置每组头部View

    - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

     

    一定要注意:

         设置每组头部和尾部VIew时,一定要设置每组头部和尾部高度,不然会不显示,因为那两个方法不会执行

    // 设置每组尾部高度

    - (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

    // 设置每组头部高度

    - (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

     

    // 进入编辑模式,不设置默认为NO

    //    tableView.editing = YES;

     

        [tableView setEditing:YES animated:YES];

     

        // tableView是否可以选中

    //    _tableView.allowsSelection = NO;

        // 是否可以多选

    //    tableView.allowsMultipleSelection = YES;

        // 编辑模式下是否可以多选

     

    //    tableView.allowsMultipleSelectionDuringEditing = YES;

    /* 设置编辑模式的类型,不实现的话默认为UITableViewCellEditingStyleDelete

        如果设置了 [tableView setEditing:YES animated:YES];会导致cell不能向右滑动

        看到删除按钮,要点击左边编辑模式才会出现删除按钮,向右滑动显示的只能

        是删除按钮,添加的模式只会出现在编辑模式为YES情况下cell的左边

    */

    - (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

    {

        return UITableViewCellEditingStyleDelete;

    }

    // 虽然这代理方法是可选的,但是不实现的话将不会出现向右滑动的删除按钮

    - (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

    {

        if (editingStyle == UITableViewCellEditingStyleInsert) {

            NSLog(@"454564");

        }

     

    }

     

    赋值数组时注意不能直接赋值,最好用arrayWithArray:方法来进行数组和数组之间的赋值

    例如

    NSArray *array1 = [NSArray arrayWithObjects:@"啦啦啦",@"哈哈哈",@"嘿嘿嘿",@"呜呜呜", nil];

    self.array1 = [NSMutableArray arrayWithArray:array1];

    NSArray 允许程序员把任何对象存进去,存进去是什么出来就是什么,使用的时候要进行强制类型转换。

    例如:

    NSArray *myArray;

    NSArray *myArray2;

    NSDate *aDate = [NSDate distantFuture];

    NSValue *aValue = [NSNumber numberWithInt:5];

    NSString *aString = @"a string";

     

    myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];//3 object

    myArray2=[myArray arrayByAddingObject:@"test"];//4 object 

     

    arrayByAddingObject:在当前数据中追加一个新的对象,并且返回一个新的数据对象(新的数组对象和被追加的对象,是两个不同的数组对象)。

  • 相关阅读:
    Leastsq 最小二乘法拟合一次函数简单入门例子
    Matplotlab 基础画图
    plot(x,y1,'g',x,y2,'b--o',x,y3,'c*') 方法中对数据类型的要求和线条类型和颜色的设置
    [Java] 获取255年前芝加哥格式化时间
    [SoapUI] 在Assertion和Groovy Script里获取RequestId
    [SoapUI] 在脚本里写code执行某个step
    [SoapUI] 获取TestStep的状态
    [SoapUI] 判断失败继续执行
    [Java] 获取两个日期间的所有日期
    [Excel] excel中如何快速统计出各个项出现的次数?
  • 原文地址:https://www.cnblogs.com/pocket-mood/p/4451346.html
Copyright © 2011-2022 走看看