ios - Place floating UIButton on top of UICollectionView -


i'm desperately trying place uibutton on top of uicollectionview. goal check-in button new foursquare app.

my code looks so:

uibutton *floatingbutton = [[uibutton alloc] init]; [floatingbutton setframe:cgrectmake(320, 150, 50, 50)]; [floatingbutton setbackgroundcolor:[uicolor blackcolor]]; [self.collectionview addsubview:floatingbutton]; [self.collectionview bringsubviewtofront:floatingbutton]; 

the problem button isn't anywhere.

you want add button collectionview's parent view. self.view, hard sure without seeing more code.

instead of

[self.collectionview addsubview:floatingbutton]; 

you want

[self.view addsubview:floatingbutton]; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -