You should use
self = [super initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
When someone calls alloc] init*
on your subclass they are creating an instance with alloc
and then the init*
method initialises the object. What you were doing is creating an entirely new object alloc] init*
which would mean that the previously allocated object would be thrown away immediately.
Keep in mind that that the compiler will be happy if you assign an instance of subclass to a pointer of it's parent class as the compiler knows that the subclass will have the same interface
@interface SubClass : SuperClass
SuperClass *instance = [[SubClass alloc] init]; // This is fine
but it can not guarantee the other way round e.g. that a parent class will implement additional behaviour that a subclass will add
@interface SubClass : SuperClass
SubClass *instance = [[SuperClass alloc] init]; // warning