无意中发现,有人创建UIButton这样写
UIButton *previousButton = [UIButtonbuttonWithType:101];
一看原来是私有api
UIButton *previousButton = [UIButton buttonWithType:101]; [previousButton setTitle:@"<" forState:UIControlStateNormal]; previousButton.frame = CGRectMake(0.f, 0.f, 30.f, 80.f); previousButton.center = CGPointMake(previousButton.frame.size.width / 2.f, pagingView.center.y); [previousButton addTarget:pagingView action:@selector(scrollToPreviousPage) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:previousButton];
更多UIButton 私有api
http://www.yifeiyang.net/iphone-development-skills-of-the-private-api-3-uibutton/