iOS Code Snippet Using OBJC to find the values of native constants

Apple documentation doesn't list the actual values of the various constants.
These values are needed when calling native methods with NativeObject.

You can use OBJC code to log these values:
B4X:
#if OBJC
-(void) test {
    NSLog(@"%@", NSForegroundColorAttributeName);
    NSLog(@"%@", NSUnderlineColorAttributeName);
    NSLog(@"%@", NSUnderlineStyleAttributeName);
    NSLog(@"%@", @(NSTextAlignmentRight)); //non-string values should be wrapped with @(...)
}
#End If

B4X:
Me.As(NativeObject).RunMethod("test", Null)
 

tucano2000

Active Member
Licensed User
Longtime User
very useful ?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…