Post

Replies

Boosts

Views

Activity

Problem with text alignment in NSAttributedString
Hi all,I have problems with text alignment.I like to right align some text on an image.My code looks like this:// my text stringNSString* myString = @"Some text";// create a dictionaryNSMutableDictionary *userAttributes = [[NSMutableDictionary alloc] init];// fill my dictionary with text properties[userAttributes setObject:[NSFont fontWithName:mySelectedFont size:myFontSize] forKey:NSFontAttributeName];[userAttributes setObject:myFontColor forKey:NSForegroundColorAttributeName];// create a paragraph style to define my text alignmentNSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];paragraphStyle.alignment = NSTextAlignmentRight;// create an NSAttributedString and add text properties to itNSAttributedString *attrString = [[NSAttributedString alloc] initWithString:myString attributes:userAttributes];// draw the "attributed string" at a given point[attrString drawAtPoint:NSMakePoint(myXTLval,myYTLval)];The text is placed exactly where I want it,the font is appliedexcept the alignment, this is not working.What am I doing wrong here?Can someone help me further?
8
0
4.1k
Dec ’19
How to implement a NSProgressIndicator in a non void function
How can I implement a NSProgressIndicator in a non void function? This is not supported in a non void function, what can I do? dispatchasync(  dispatchgetglobalqueue(DISPATCHQUEUEPRIORITYDEFAULT, 0),   dispatchasync(dispatchgetmain_queue(), ^{             [myProgressBar setUsesThreadedAnimation:YES]; [myProgressBar setHidden:FALSE]; [myProgressBar setDoubleValue:15.0]; [myProgressBar startAnimation:myProgressBar]; });   });  any help is very appreciated.
1
0
476
Dec ’20
Use of undeclared identifier
I'm working on an objective c based macos project for years, containing numerous Objective C classes. For some reason, in a particular class I can bind new IBOutlets in Interface builder, but in my .m file I get always the error: Use of undeclared identifier ' my buttoname ' Someone any idea? I'm working with: XCode 13.2.1
1
0
3.0k
Feb ’22