小编nsp*_*vlo的帖子

iOS 6和iOS 7 UIButton标签垂直对齐

当我尝试对齐uibutton textlabel时出现问题.在ios6上,它位于中心位置,但在ios7上它大约低了4个像素.

按钮类

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setBackgroundImage:[UIImage imageNamed:@"circle"] forState:UIControlStateNormal];
        [self.titleLabel setFont:[UIFont seBoldUserFontOfSize:13.0]];

        _numberLabel = [[IBMSmallDescriptionTextLabel alloc] initWithFrame:CGRectMake(5.5, 0, 18, 18)];
        [self addSubview:_numberLabel];
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

在自定义标题中:

- (void)createButtons
{
    for (int i = 0; i <= 5; i++)
    {
        IBMStageButton *button = [[IBMStageButton alloc] initWithFrame:CGRectMake(18.0 + (60.0 * i), 1.0, 18.0, 18.0)];
        [button.numberLabel setText:[NSString stringWithFormat:@"%d", i+1]];
        [self addSubview:button]; // self frame W320 H23
    }
}
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton ios

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

Swift instantiateViewControllerWithIdentifier

目前我有:1.初始ViewController - AppStateViewController 2 .TabBarController - AuthorizedSessionViewController 3. ViewController - UnauthorizedSessionViewController

AppStateViewController代码 - https://gist.github.com/nspavlo/de7a03f80e57694a12ba

如果我在viewDidLoad()中调用switchToAuthorizedSessionViewController()和switchToUnauthorizedSessionViewController(),则会出现AuthorizedSessionViewController而不是UnauthorizedSessionViewController.

我的gol是在didFinishLaunchingWithOptions上加载右控制器并在更改appState时更改它.

ios swift

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

标签 统计

ios ×2

objective-c ×1

swift ×1

uibutton ×1