.h中
@protocol GeneralCellPadDelegate<NSObject>
@required
@optional
- (void)showRemindView:(GeneralCellPad*)cell;
-(BOOL) isCanInstallTheUpdate:(EntryUpdate*)entryUpdate;
@end
@property (nonatomic, assign) id<GeneralCellPadDelegate> delegate;
.m中
@synthesize delegate = _delegate;
利用tag取值
1.
_settingPanel = [[SettingViewalloc]init];
_settingPanel.tag = 5000;
//调用的时候
UIView* innerView = [_settingPanel viewWithTag:5000];
2.
_songTiBtn = [[UIButtonalloc]init];
[_songTiBtnsetImage:[MHFileimageWithResourceName:@"song_ti_pad.png"] forState:UIControlStateNormal];
[_songTiBtnaddTarget:selfaction:@selector(changeFontStyle:) forControlEvents:UIControlEventTouchUpInside];
songTiBtn.tag = 1000;
//调用的时候
UIButton* button = (UIButton*)[innerView viewWithTag:1000];
iOS5.0和iOS66.0旋转的代码
#pragma mark 允许旋转屏幕
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
_deviceDirection = interfaceOrientation;
_bShouldAutorotate = YES;
returnYES;
}
#pragma mark 屏幕坐标调整
-(void)viewWillAppear:(BOOL)animated
{
if (_bShouldAutorotate)
{
[selfsetFrameToRotation:_deviceDirection];
}
else
{
//若离开词条界面时候是横屏进入点击图片界面变成竖屏则返回到词条的时候仍然是横屏这个时候要从点击图片界面传一个方向
[selfsetFrameToRotation:deviceDirection];
}
}
#pragma mark 旋转窗口
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[self setFrameToRotation:toInterfaceOrientation];
}
//-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
//{
//
//}
#pragma mark - 适配6.0旋转屏幕
//不执行
////#pragma mark ios6.0支持旋转屏幕(ios6.0去掉了shouldAutorotateToInterfaceOrientation)
//- (BOOL)shouldAutorotate
//{
// return YES;
//}
#pragma mark ios6.0支持旋转屏幕的方式
-(NSUInteger)supportedInterfaceOrientations
{
_deviceDirection = self.interfaceOrientation;
[selfsetFrameToRotation:_deviceDirection];
_bShouldAutorotate = YES;
//支持四种旋转方式
returnUIInterfaceOrientationMaskAll;
}
#pragma mark -
#pragma mark 设置横屏竖屏坐标
-(void)setFrameToRotation:(UIInterfaceOrientation)interfaceOrientation
{
//竖屏
if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
}
//横屏
else
{
}
}