开发者

how can i add multiple web SubViews in a single view?

i'm开发者_如何学编程 doing my first iPAD project. i've recently learnt objective C so i do not have in depth knowledge of it. I'm writing a code to generate subviews. Similar concept to that of "SAFARI". i've to keep a track of all the recently opened url and display that web page as a subview.


You can access subviews of a view in array style like [[self.view subviews] objectAtIndex:0]

So you could create an array of e.g. dictionaries if you need more than just the url.

E.g. you could store url, last visit, title etc.. in a dictionary and then add it to an array.

Hope this can help you!

Cheers mate.


After creating the UIView (with or without a UIViewController) you can add the subview to the original view by typing

[self.view addSubview:myNewView];

(don't forget memory management if necessary). If you use a viewController, you'll need to do:

[self.view addSubview:myNewViewController.view];

You MUST set the "frame" variable of the new view if it is going to work. This is done as so:

[myNewView setFrame:CGRectMake(x, y, width, height)];

G'luck.

H

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜