chocks
chocks

Reputation: 33

how can i make one default view on application launching to present

I am new to iOS application development. I am making an app in which I want to show custom view on scrollview and added views on scrollview, but it is showing view from the first view. Can I get second view to present at first.

scrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(0,80,320,360)];
[scrollview setContentSize:CGSizeMake(2550,360)];
[scrollview setScrollEnabled:YES];
[scrollview setPagingEnabled:YES];
[scrollview setBackgroundColor:[UIColor clearColor]];
scrollview .indicatorStyle = UIScrollViewIndicatorStyleDefault;
scrollview.showsHorizontalScrollIndicator = NO;
scrollview.showsVerticalScrollIndicator = NO;
scrollview.scrollsToTop = NO;
scrollview.delegate = self;
scrollview.tag=500;
[self.view addSubview:scrollview];


afterloginPageControl=[[UIPageControl alloc]initWithFrame:CGRectMake(0, 440, 320, 25)];
afterloginPageControl.numberOfPages = 8;
afterloginPageControl.backgroundColor = [UIColor darkGrayColor];

afterloginPageControl.highlighted = YES;
afterloginPageControl.hidesForSinglePage = YES;
afterloginPageControl.currentPage = 0;
afterloginPageControl.selected = YES;
[afterloginPageControl addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventTouchUpInside];
// create Pages..
//[self createPages];
// add View
[self.view addSubview:afterloginPageControl];


info=[[InfoView alloc]initWithFrame:CGRectMake(0,  80,315, 350)];
info.delegate=self;

info.backgroundColor=[UIColor whiteColor];

[scrollview addSubview:info];


update=[[UpdateViewControll alloc]initWithFrame:CGRectMake(320,  80,320, 350)];
update .delegate=self;
update.backgroundColor=[UIColor whiteColor];
[scrollview addSubview:update];


search=[[SearchViewControll alloc]initWithFrame:CGRectMake(640,  80,320, 350)];
//info.delegate=self;
search.backgroundColor=[UIColor whiteColor];
[scrollview addSubview:search];

Upvotes: 2

Views: 57

Answers (1)

user1865478
user1865478

Reputation:

Use this code after adding view on scrollview in viewDidLoad.

[scrollview scrollRectToVisible:CGRectMake(320,  80,320, 350) animated:YES];

Upvotes: 4

Related Questions