code 1.
let alert 1= UIAlertController(title: “Time is up!”,message: “You scored \(count) points”,preferredStyle: UIAlertControllerStyle.Alert)
alert1.title=“no time”
---------------------title of alert1 is changed----------------------
code2.
let alert2 = UIAlertAction(title: “Play Again”, style: UIAlertActionStyle.Default, handler:nil)
alert2.title=“no play”
---------------------title of alert2 can not change------------------
Why alert1 can be changed the title but alert2 can’t?
UIAlertController.title is mutable.
UIAlertAction.title is immutable.
Why they designed them this way, I do not presently know. If I were to make them, I’d likely make all the properties immutable.
Thank you for your help.
I check the iOS documentation, but I still don’t understand it.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/
(It says:The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified. )
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertAction_Class/
(No information about this.)
It’s very confused!