Holding onto a struct

How can I hang onto the following struct outside of the method it is created? I've been trying to assign it to a instance variable or property without much luck.

@property(nonatomic) CTParagraphStyleSetting defaultParagraphSettings;

- (void)someMethod {
    CTParagraphStyleSetting settings[] = {
        { kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment },
        { kCTParagraphStyleSpecifierLineBreakMode, sizeof(CTLineBreakMode), &lineBreakMode },
    self.defaultParagraphSettings = settings;

self.defaultParagraphSettings = settings; generates the following error:

Assigning to 'CTParagraphStyleSetting' (aka 'struct CTParagraphStyleSetting') from incompatible type 'CTParagraphStyleSetting [4]'

Am I going about this the right way?


The error message is telling you that the variable settings is of type array of CTParagraphStyleSetting, the property defaultParagraphSettings is of type CTParagraphStyleSetting. So you have two problems, (1) the types are incompatible and (2) (Objective-)C does not support array assignment.

I can't tell you how to fix it as that depends on what you're trying to do. But for example, the statement:

self.defaultParagraphSettings = settings[0];

should assign the first element of the array to the property.

Need Your Help

Is there an “average” time zone per country?

date timezone scheduling tournament

I want to schedule an online multiplayer game tournament, one per unique country, with a convenient start time for as many registered players as possible.