随机颜色,使程序崩溃提醒
// 随机颜色
- (UIColor*)randomColor
{
CGFloat r = arc4random() % 256 / 255.0;
CGFloat g = arc4random() % 256 / 255.0;
CGFloat b = arc4random() % 256 / 255.0;
return [UIColor colorWithRed:r green:g blue:b alpha:1];
}
调用:[[self randomColor] set];
使程序崩溃提醒
if (!(self.bounds.size.width == self.bounds.size.height)) {
// 崩溃
// [NSException raise:@"回去看看的宽高是不是相等再来用" format:@"宽高不想等"];
NSException* ex = [NSException exceptionWithName:@"name" reason:@"reason11111" userInfo:nil];
[ex raise];