Initialize NSArray with floats?

后端 未结 7 1679
情歌与酒
情歌与酒 2021-02-12 20:05

Is this a valid way to initalize an NSArray with float objects?

NSArray *fatArray = [NSArray arrayWithObjects:
                    [NSNumber numberWithFloat:6.9]         


        
7条回答
  •  广开言路
    2021-02-12 20:31

    I agree with mouviciel. Since you can't put simple types into an Array this is the way to do it. Looks a bit strange and is a lot of code to write but it is fine.

提交回复
热议问题