I’m trying to change the alignment of a UILabel on the main thread like this
[updateLabel performSelectorOnMainThread:@selector(setTextAlignment:) withObject:UITextAlignmentCenter waitUntilDone:YES];
However this generates a “makes pointer from integer without cast error. What’s the correct way to do this?
This is not going to work because
UITextAlignmentCenteris not a pointer to an object, but a simple integer. A solution is to implement an own method on the view controller that sets the alignment to center viaupdateLabel.textAlignment = UITextAlignmentCenter;and calling[yourViewController performSelectorOnMainThread:@selector(setUpdateLabelTextAlignmentToCenter) withObject:nil waitUntilDone:YES];