Can undesrtand how to pass Dictionaries types in IOS

(DonaldShimoda) #1

Trying to use that objective C Code

 [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSForegroundColorAttributeName:[UIColor whiteColor]}];

Oxydizer traslate to this:

self.navigationController.navigationBar.setTitleTextAttributes([[NSForegroundColorAttributeName, UIColor.whiteColor()]]);

But get an error on first parameter

error E486: Parameter 1 is “”, should be “NSDictionary”,

(JohnMoshakis) #2

I think it got it wrong.

This should work

    var attr := NSDictionary.dictionaryWithObjectsAndKeys(UIColor.clearColor, NSForegroundColorAttributeName, nil);
    self.navigationController.navigationBar.titleTextAttributes := attr;


(DonaldShimoda) #3

Thanks for your help,
The code was only a sample, i wan to set the atribute to a UIBarButtonItem, dont have a

titleTextAttributes method, only have


Newbie on COCOA sorry for so many questions.

Best regards.

(marc hoffman) #4

Yes, Oxygene currently;y does not have a dictionary literal syntax, only Swift and C# do. You’ll need to use the APIs to create/fill your NSDictionary or Elements RTL Dictionary in

it’s probably a property, and setTitleTextAttributes would be the corresponding setter method, if you prefer calling that?

(DonaldShimoda) #5

Seems like that works:

var attr := NSDictionary.dictionaryWithObjectsAndKeys(UIColor.redColor, NSForegroundColorAttributeName, nil);
self.main_status.setTitleTextAttributes(attr) forState(UIControlState.Normal);

Main, im really lost here. Is a kinda mix of pascal and smalltalk.

Maybe better to migrate all to swift and be consistent with this?

Will continue figthing with this.

Best regards!

(marc hoffman) #6

not really.

(DonaldShimoda) #7

I see. The problem with this is the posibility to share code between different plattforms is dramatically reduced. Im writing almost all my android code again to support IOS. Despite the lack of same of uniform interface between dataabstract fro JAVA and COCOA (already discused).

Will take a bit more of the time i think will take, not complaining at all, but sure i will do a lot of questions i hope dont matter to help. :wink:

Best regards.