1.首先用构造方法直接创建
UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView alloc]init];
此时frame打印结果{{0, 0}, {0, 0}},并且其属性hidden = YES
直接添加到视图上,调用方法[indicatorView startAnimating];
此时打印frame={{120, 15}, {20, 20}}
也就是,在开启动画的时候打印indicatorView.activityIndicatorViewStyle
因为是枚举值,打印结果是1,也就是UIActivityIndicatorViewStyleWhite
若是在创建之后,指定indicatorView.activityIndicatorViewStyle,此时打印frame,其值仍为{{0, 0}, {0, 0}},只有在开启动画是才能打印出非0值
2.使用initWithActivityIndicatorStyle方法创建,
UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
此时打印frame
UIActivityIndicatorViewStyleWhiteLarge, {{0, 0}, {37, 37}}
UIActivityIndicatorViewStyleWhite, {{0, 0}, {20, 20}}
UIActivityIndicatorViewStyleGray {{0, 0}, {20, 20}}
综上使用init创建时frame = {{0, 0}, {0, 0}},指定indicatorView.activityIndicatorViewStyle,亦然
使用initWithActivityIndicatorStyle创建,frame根据activityIndicatorViewStyle确定,且不能更改frame