I am using a horizontal scrollview
with some buttons and a search bar.I need to show it in all view controllers .Here is my code
for (int i=0;i<[[[xmlSubDictionary objectForKey:@"pillars"]objectForKey:@"pillar"]count];i++)
{
[pillarArray addObject:[[[[[xmlSubDictionary objectForKey:@"pillars"]objectForKey:@"pillar"]objectAtIndex:i]objectForKey:@"pillarName"]objectForKey:@"text"]];
///// UIButton* ideaButton = [[UIButton alloc] initWithFrame:CGRectMake((i*self.scrolView.frame.size.width)/2.5, 3, self.scrolView.frame.size.width/2.5,40)];
if (i==0)
{
ideaButton.frame = CGRectMake((i*self.scrolView.frame.size.width)/2.5, 3, self.scrolView.frame.size.width/2.5, 40);
[self.view bringSubviewToFront:self.scrolView];
[ideaButton setTitleColor:[UIColor colorWithRed:0 green:175 blue:69 alpha:1] forState:UIControlStateNormal];
}
else
{
[ideaButton setTitleColor:[UIColor colorWithRed:0.42 green:0.42 blue:0.42 alpha:1] forState:UIControlStateNormal];
}
[ideaButton setTitle:[[pillarArray objectAtIndex:i] uppercaseString] forState:UIControlStateNormal];
[ideaButton setTag:101+i];
[ideaButton addTarget:self action:@selector(ActionForMealButtonAction:) forControlEvents:UIControlEventTouchUpInside];
ideaButton.titleLabel.font = [UIFont fontWithName:@"Akkurat-Bold" size:17.0];
ideaButton.backgroundColor = [UIColor clearColor];
[self.scrolView addSubview:ideaButton];
}
[self.scrolView setContentSize:CGSizeMake([pillarArray count] * ((self.view.frame.size.width+200)/([pillarArray count])-5), CGRectGetHeight(self.scrolView.frame))];