将活动圈定位在UIActivityIndi​​cator内部,使其略微降低

时间:2016-02-18 06:03:41

标签: ios uiactivityindicatorview

我正在自定义 UIActivityIndi​​catorView

添加背景颜色和textlabel后,我的活动指示器如下所示:

https://docs.strongloop.com/display/public/LB/Operation+hooks

但是现在我想把圈子移动一点,以便在文本“加载”之间留出一些空隙。和圈子。我希望它看起来像这样:

Github

怎么做?

代码:

UIActivityIndicatorView *activity=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    [activity setFrame:CGRectMake(0, 0, 60, 60)];
    activity.layer.cornerRadius=5;
    [activity startAnimating];
    activity.color=[UIColor whiteColor];
    activity.backgroundColor=[[UIColor blackColor]colorWithAlphaComponent:0.6];
    [activity setCenter:CGPointMake([UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/2)];
    [activityBackView addSubview:activity];

    UILabel *loading=[[UILabel alloc]initWithFrame:CGRectMake(0, -3, 60, 25)];
    loading.text=@"Loading...";
    loading.font=[UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:12];
    loading.textColor=[UIColor whiteColor];
    loading.textAlignment=NSTextAlignmentCenter;
    loading.clipsToBounds=YES;
    [activity addSubview:loading];

0 个答案:

没有答案