ios - object instantiated by UINib not showing its proper class? -


i have xib file, view, , have designated fooview class.

when allocate it:

uinib *fooviewxib = [uinib nibwithnibname:@"fooview" bundle:[nsbundle mainbundle]]; fooview *fooview = [[fooviewxib instantiatewithowner:self options:nil] lastobject]; fooview.lollabel.text = @"lol"; 

if ask it:

[fooview iskindofclass:[fooview class]]; 

it says no...

yet, if nslog fooview object, says it's fooview. , if nslog class of fooview object directly, shows fooview class.

why iskindofclass not correctly identify object, , how can so?

instead of using lastobject, loop through array until find view correct class. this

nsarray *nibviews = [[nsbundle mainbundle] loadnibnamed:@"fooview" owner:self options:nil]; fooview *view; (id object in nibviews)     if ([object iskindofclass:[fooview class])         view = object; // whatever want view 

this ensure view correct class.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -