1

I am using nidropdown in tableview in ipad. There are two views viewleft and viewright.

In viewright have tableview. I am create a button and set action for nidropdown. If table cell pressed dropdown doesn't show fully in the view because table have only two cell and it's Center of view.

I found answer like bringSubviewToFront it's doesn't work for me. Link where i get ans

Here my code

[tableView addSubview:nidropDown];
[viewRight addSubview:tableView];
[[tableView superview] bringSubviewToFront:nidropDown];

What I did wrong in that code... :(

Thanks in Advance.. :)

Community
  • 1
  • 1
Mathi Arasan
  • 869
  • 2
  • 10
  • 32

2 Answers2

1
[tableView addSubview:nidropDown];
[viewRight addSubview:tableView];
[[tableView superview] bringSubviewToFront:nidropDown];

In your code, nidropDown is a subview of tableView so it can only go up that subview chain... you need to either

1.

[viewRight addSubview:tableView];
[viewRight addSubview:nidropDown];

or 2.

[tableView bringSubviewToFront:nidropDown];
Magoo
  • 2,552
  • 1
  • 23
  • 43
  • I am already tried this and also I did max possible combination. Still it's doesn't work. My table view in center of view so nidropdown show top of the viewRight. – Mathi Arasan Apr 22 '15 at 12:23
  • So the correct combination for you is definitely `[viewRight addSubview:tableView];` then `[viewRight addSubview:nidropDown];` that will put the nidropdown in `viewRight` above the tableview (if that's what you want) if it's not appearing in the right place, you should look at the frame of this view? – Magoo Apr 22 '15 at 12:30
  • To confirm, calling `bringSubviewToFront` on a view that isn't its subview won't do anything.. – Magoo Apr 22 '15 at 12:33
  • If i did this [viewRight addSubview:nidropDown]; it show top of the viewright. But my table view is center of the viewRight. Yes I am look that frame it's show with where my button frame is placed like (10,10,250,50) in what i did for addSubview (viewright or tableview). Is any possible to find exact frame start and ending for my table view if i find that [viewRight addSubview:nidropDown]; this code work perfectly. Based on tableview then i will change my viewright frame also that why (I think) work perfectly. – Mathi Arasan Apr 22 '15 at 12:49
  • Right, so a few things then... If you want the `nildropDown` to be a subview of the tableview that's fine, but `[[tableView superview] bringSubviewToFront:nidropDown];` will not work as it's not a subview of `[tableView superview]` It sounds like your tableview height is dynamically set to it's contents? It's very difficult to tell, but if the entire pull down is not showing it's probably because the frame of your tableview is too small... can you edit your questions and add more code? – Magoo Apr 22 '15 at 12:59
  • another option might be to set `tableview.clipsToBounds = NO` – Magoo Apr 22 '15 at 13:00
  • Thanks for ur time. I am just found a solution. Change my tableview height that's it. once again Thanks you.... – Mathi Arasan Apr 22 '15 at 14:04
  • I wrote that in the comment above.... *if the entire pull down is not showing it's probably because the frame of your tableview is too small* – Magoo Apr 23 '15 at 09:43
  • If I select first cell nothing to worry else I select last one then only this problem occurred. My table view center of view so it's easy to change tabelview size. – Mathi Arasan Apr 24 '15 at 13:19
0

Increasing your dropdown height.....

CGFloat f = 81;

 dropDown = [[NIDropDown alloc]showDropDown:sender Height:&f Array:arr ImageArray:nil Direction:@"down"];
Rahul Mayani
  • 3,761
  • 4
  • 25
  • 40