В iphone sdk как вызвать класс из другого класса?вызов класса из другого класса
мне нужно открыть класс background.m,
-(void)brightness
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image = [UIImage imageNamed:@"brightness.jpg"];
button.frame = CGRectMake(0, 0, image.size.width, image.size.height);
[button setImage:image forState:UIControlStateNormal];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image1 = [UIImage imageNamed:@"brightness.jpg"];
button1.frame = CGRectMake(0, 0, image1.size.width, image1.size.height);
[button1 setImage:image forState:UIControlStateNormal];
[button1 addTarget:self action:@selector(brightnessControl:) forControlEvents:UIControlEventTouchUpInside];
gBrightnessSetting=100;
brightnessOverlay = [[CALayer alloc] retain];
brightnessOverlay.masksToBounds = YES;
brightnessOverlay.backgroundColor = [[[UIColor blackColor] colorWithAlphaComponent:1.0] CGColor];
brightnessOverlay.opacity = 0.0;
[self.layer addSublayer:brightnessOverlay];
bottomButtonsSize = SCREENWIDTH/5;
}
- (void)dealloc {
[brightnessLessButton release];
[brightnessMoreButton release];
[super dealloc];
}
- (void) setLayerFrames {
brightnessOverlay.frame = CGRectMake(self.layer.bounds.origin.x,self.layer.bounds.origin.y,self.bounds.size.width,self.layer.bounds.size.height);
}
In ebook.m class,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath row]==0) {
background *back=[[background alloc] init];
[back brightness];
}
Поскольку методы объектов вызывают методы объекта, ваш вопрос довольно сложно ответить. Можете ли вы предоставить образец кода, чтобы показать, что вы имеете в виду? –
Мне нужно получить доступ к этому фоновому классу, – user579911
Нет. Вам нужно получить доступ к объекту этого класса. Не сам класс. –