String Length Limitation with UIAlertViews in IOS7?

只谈情不闲聊 提交于 2019-12-11 12:07:13

问题


I'm working in a new iOS app and I noticed the following issue installing the app in iOS7 environment.

After opening the app by first time, our app displays a popup with the AGB's that needs to be accepted in order to start using it. We used a UIAlertView and it worked fine until we tested with iOS7. Actually the alert pops up and seems to have content since I can see a huge scrollbar! But the strange thing is that the text is not shown at all.... After playing a bit with the text I noticed that the new UIAlertView of iOS7 has some kind of string length limit...

Has anybody else noticed that? Is this normal, or an iOS 7 bug?

I found that custom UIAlertView works, but I would rather use a native API if possible.


回答1:


I can confirm what you say. post a radar maybe -- there is no reason for this.

for(int i = 0; i < 10000; i++) {
    longTextVar = [longTextVar stringByAppendingFormat:@"%d", i];
}
UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"agb" message: longTextVar delegate: self cancelButtonTitle:@"ok" otherButtonTitles:nil];

breaks it, while 1000 appends work




回答2:


I encountered with the same UIAlertView problem, where in the simulator the scrollview was big enough to hold the long text but text was not there. After I tried the show same lenght message on iphone alertview did show the message.

Therefore, I think this is a simulator issue, not really a limitation, and that is why it is not documented.



来源:https://stackoverflow.com/questions/19520260/string-length-limitation-with-uialertviews-in-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!