小编Esp*_*sso的帖子

将字符串转换为int

我在将字符串转换为整数时遇到问题.我搜索了它,但我能找到的是如何将int转换为字符串.有没有人知道如何做到反过来?谢谢.

xcode objective-c ios4 ios

87
推荐指数
2
解决办法
13万
查看次数

char数组长度为C.

在C中,您必须声明数组的长度:

int myArray[100];
Run Code Online (Sandbox Code Playgroud)

但是当你处理chars和字符串时,长度可以留空:

char myString[] = "Hello, World!";
Run Code Online (Sandbox Code Playgroud)

编译器是否通过查看字符串为您生成长度?

c

5
推荐指数
3
解决办法
1005
查看次数

使用缓存的UIView在tableView中设置单元格背景视图:willDisplayCell:forRowAtIndexPath:

这是我设置自定义分组表视图单元格背景的解决方案:

- (UIView *)top
{
    if (_top) {
        return _top;
    }

    _top = [[UIView alloc] init];
    [_top setBackgroundColor:[UIColor blueColor]];

    return _top;
}

// dot dot dot

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger section = [indexPath section];
    NSInteger row = [indexPath row];
    NSInteger maxRow = [tableView numberOfRowsInSection:section] - 1;

    if (maxRow == 0) {
        [cell setBackgroundView:[self lonely]];
    } else if (row == 0) {
        [cell setBackgroundView:[self top]];
    } else if (row == maxRow) {
        [cell setBackgroundView:[self bottom]];
    } …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c ios

5
推荐指数
2
解决办法
2473
查看次数

类型和生命周期限定符之间的区别

在Objective-C或任何其他适用的语言?

我想我要问的是,是__weakconst在分类方面一样吗?我可以互换的条款类型和寿命预选赛时,我说的是__weak,const等?

objective-c automatic-ref-counting

3
推荐指数
1
解决办法
344
查看次数

jQuery:在元素内部添加一个数字

我正在尝试p使用jQuery 在元素内添加一个数字,但它不起作用.

$(document).ready(function() {
            function addOne() {
                var number  =   $('p').html();
                return number++;
            }

            $('p').text(addOne());
        });

javascript jquery

2
推荐指数
1
解决办法
3483
查看次数

Objective-C字符串差异

NSString *myString = @"Johnny Appleseed"对比之间有什么区别NSString *myString = [NSString stringWithString: @"Johnny Appleseed"]

使用其中任何一个都是好的情况?

cocoa objective-c

0
推荐指数
1
解决办法
264
查看次数