https://developer.apple.com/documentation/uikit/uibutton/1624028-buttonwithtype?language=objc
Discussion
This method is a convenience constructor for creating button objects with specific configurations. If you subclass UIButton, this method does not return an instance of your subclass. If you want to create an instance of a specific subclass, you must alloc/init the button directly.
My test:
@interface MyButton : UIButton
@end
@implementation MyButton
@end
test output:
NSLog(@"%@", NSStringFromClass([MyButton buttonWithType:UIButtonTypeCustom].class));
output:
MyButton
the document is old or wrong ?