小编use*_*123的帖子

iOS 6中的标签对齐 - 不推荐使用UITextAlignment

似乎UITextAlignmentCenter在iOS 6中已弃用.

我仍然使用它并且效果很好,但它会发出警告.

我怎样才能解决这个问题?

label.textAlignment = UITextAlignmentCenter;
Run Code Online (Sandbox Code Playgroud)

谢谢.

label alignment ios

190
推荐指数
5
解决办法
9万
查看次数

在iOS5中的UITableView中出现dequeueReusableCellWithIdentifier错误

我在iOS 5中收到此错误

-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]: unrecognized selector sent to instance 0xa217200

但是,我在iOS 6中没有错误.我该如何解决这个问题?这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"MyCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; /// SIGABRT error

    if (!cell)
    {
        cell = [[UITableViewCell alloc]
        initWithStyle: UITableViewCellStyleSubtitle
        reuseIdentifier: CellIdentifier];
    }

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

uitableview ios ios5 ios6

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

如何在UIScrollView(Obj-C)中禁用垂直滚动

如果可能,我想从我的UIScrollView禁用垂直滚动..我的代码如下所示.工作正常,除了用户可以上下滚动,这不应该在那里我相信..在此先感谢..

    UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, self.view.frame.size.height / 3)];   
    scroll.contentSize = CGSizeMake(scroll.contentSize.width,scroll.frame.size.height); 
    scroll.pagingEnabled = YES;
    scroll.backgroundColor = [UIColor blackColor];
    int xVal = 30;

    NSInteger numberOfViews = 5;
    for (int i = 0; i < numberOfViews; i++) {
        UILabel *testLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 0, 90, 100)];
        UILabel *testLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 20, 90, 100)];
        UILabel *testLabel3 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 40, 90, 100)];

        testLabel2.backgroundColor = [UIColor clearColor];
        testLabel2.text =@"Test1";
        testLabel2.textColor = [UIColor whiteColor];
        testLabel2.font = [UIFont …
Run Code Online (Sandbox Code Playgroud)

objective-c uiscrollview ios

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

如何在LHBezier中检索makeStatic或makeDynamic方法?LevelHelper - Cocos2D

在LevelHelper中,我能够将bezier形状设置为静态,动态等.在我的代码中,我需要更改这些属性.有人可以帮我吗?

LHBezier* bezier = [loader bezierWithUniqueName:@"BezierNode"];

[bezier makeStatic]; // not working
Run Code Online (Sandbox Code Playgroud)

cocos2d-iphone ios levelhelper

5
推荐指数
1
解决办法
160
查看次数

如何在iOS中以编程方式更新UILabel

我正面临更新我的标签的问题..它不会删除旧的值,所以新的值会在旧的值之上..任何有关此的帮助将不胜感激..

timer = [NSTimer scheduledTimerWithTimeInterval:1
                                         target:self
                                       selector:@selector(updateLabels)
                                       userInfo:nil
                                        repeats:YES];

-(void) updateLabels{
    for (GraphView *graph in arr){
        // retrieve the graph values
        valLabel = [[UILabel alloc] initWithFrame:CGRectMake(i * 200, 0, 90, 100)];
        valLabel.textColor = [UIColor whiteColor];
        valLabel.backgroundColor = [UIColor clearColor];
        valLabel.text = [NSString stringWithFormat:@"Value: %f", x];
        i++;
    }        
}
Run Code Online (Sandbox Code Playgroud)

uilabel ios

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