加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 这个黑客会让苹果大发雷霆吗? (拒绝我的应用程序吗?

发布时间:2020-12-14 18:12:34 所属栏目:百科 来源:网络整理
导读:我从这里获取了这段代码 Changing the background color of a UIAlertView? UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"YOUR MESSAGE HERE",nil) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] a
我从这里获取了这段代码

Changing the background color of a UIAlertView?

UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
   message: @"YOUR MESSAGE HERE",nil)
   delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];

   [theAlert show];

   UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
   [theTitle setTextColor:[UIColor redColor]];

   UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"];
   [theBody setTextColor:[UIColor blueColor]];

   UIImage *theImage = [UIImage imageNamed:@"Background.png"];    
   theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16];
   CGSize theSize = [theAlert frame].size;

   UIGraphicsBeginImageContext(theSize);    
   [theImage drawInRect:CGRectMake(0,theSize.width,theSize.height)];    
   theImage = UIGraphicsGetImageFromCurrentImageContext();    
   UIGraphicsEndImageContext();

   [[theAlert layer] setContents:[theImage CGImage]];

由oxigen发布的.

我不太确定我应该在我的应用程序中使用此代码.苹果会不会有任何关于这个黑客的问题(他们会拒绝这个应用吗?)

解决方法

下划线作为您正在访问的属性的前缀(_titleLabel,_bodyTextLabel)清楚地表明这些是私有属性,不应该被修改. Apple最近开始扫描所有提交的二进制文件以访问私有方法和属性,这些值在您的应用程序中自行应该足以让您被拒绝.使用私有API,拒绝或拒绝是绝对不是一个好主意,因为它们通常是私有的,并且可能会因未来的操作系统更新而破坏您的应用程序.

此外,您通过更改警报颜色违反了iPhone Human Interface Guidelines:

You can specify the text,the number
of buttons,and the button contents in
an alert,but you can’t customize the
background appearance of the alert
itself.

再次,从iPhone Human Interface Guidelines:

Because users are accustomed to the appearance and behavior of these views,it’s important to use them consistently and correctly in your application.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读