Recognize Gestures behind a Transparent UITableView - objective-c

In the view hierarchy, seen in the diagram below, I would like to be able to drag the portion of the map that can be seen through the clear UITableView (2).
--------------------------------
|1. MKMapView |
| -------------------------------
| |2. Clear UITableView | |
| | Content Offset | |
| | | |
| | | |
| -------------------------------
| |Cell |
| -------------------------------
| |Cell |
-------------------------------
The MKMapView is behind a UITableView. The UITableView that has a positive content offset and a clear background.
At the moment the UITableView is taking the gesture and the map can not be panned. How can I tell the table view that is should only scroll when the cells are panned.

If you can, change the frame of the table view so it just isn't placed over the map.
If you can't, subclass the table view and implement hitTest: to decide if the user interaction should be handled by the table view or not.

Related

how to show many image from URL in UIscrollView

I want create one page that has 3 horizontal (right to left) Scroll in top & middle & down page.
in each scrollview there are many image like this :
----------------------------------------
| ------- -------- -------- |
| | | | | | | | Outside the box is scroller!!!
| | | | | | | |
| ------- -------- -------- |
----------------------------------------
in any page of scroll exist 3 image .
I want when change page of scroll images that exist this page changing!!! (like Scroll in IMDB application)
I can create Scroll and I can read many images from URL but I can not connect these!!! :(
please tell me about.
Check iCarousel brilliant lib for doing stuff like that. It includes a lot of examples and compatible with iOS5.
This might work for you:
A. Create a UIView to hold 3 UImageViews to contain the 3 images.
B. Add the UIView as the contentView of the UISrollView.
C. Use a combination of UIPageControl and UIScrollView.

UITableView Space 3 UITableViewCells across entire device frame evenly

I'm writing an app that has a view with nested UITableViews. The UITableViews in the cells of the outer UITableView are rotated 90 degrees so that they scroll horizontally. The UITableViewCells in the main UITableView are of the class HorizontalTableViewCell.
UITableView
--------------------------------------------------
| | | |
| | | | HorizontalTableView
| > | > | > | (contained inside
| | | | UITableView's
| | | | UITableViewCell)
--------------------------------------------------
| | | |
| | | |
| > | > | > | |
| | | | \ /
| | | | "
--------------------------------------------------
| | | |
| | | |
| > | > | > |
| | | |
| | | |
--------------------------------------------------
When in portrait mode, I have the content spaced evenly by setting the HorizontalTableView's width to the screen width in the initWithFrame: method.
I would like to increase the cell padding of the HorizontalTableView's cells such that when the device is rotated to landscape mode, the 3 cells are resized to fit the entire screen, each taking up an equal amount of space.
However, the best I can seem to achieve is a HorizontalTableView of the same portrait width, but centered in the screen by the following bitmask (from HorizontalTableViewCell's implementation file):
self.horizontalTableView.autoresizingMask =
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin;
This produces a large margin on both sides of the HorizontalTableView, effectively centering the cells, but the individual cell padding remains unchanged.
Any ideas on how I would go about doing this?
(Note that if the following bit mask is used, the cells fly out of view "through the top" of the HorizontalTableViewCell and cannot be seen again, even if the device rotates back to portrait mode).
self.horizontalTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
The only way I can think of is to create another view for the landscape mode. Throw your data into a holder object, load the new view, and then reload the data from the holder.

UILabel dissapearing when going out of his parent view

I'll try to explain my problem as clear as I can:
Imagine that we have a UIView in the middle of our screen, and inside of this view, there is, for ex. a UILabel.
Now I want to move the UILabel out of the view, so I make and animation and change the frame of the label to be out of its view. The problem is that now the UILabel is visible in the other view! I want the UILabel dissapearing when it goes out of the view
| _________ |
| | | |
| | label | |
| |_______| |
| |
Now I move label to the left
What is happening now:
_________
| | |
|la|bel |
| |_______|
What I want:
_________
| | |
| |bel |
| |_______|
Make sure that,
parentView.clipsToBounds = YES;

Attach a UIView to a UIViewController programmatically?

What is the best way of having a block of screen run by it's own view controller, whilst the rest of the app runs as normal, switching between views etc.
So the block of screen would be a permanent fixture (tho could be hidden), while the user can switch between tab, push new views etc?
Is there a way to programmatically attach a view to a view controller to do this, or is there some other method?
-----------------------------------------
| |
| nav bar or tool bar |
-----------------------------------------
| |
| |
-----------------------------------------
|view to be attached to view controller | < this block stays even when in other views
-----------------------------------------
| |
| |
| |
| main bit of the view |
| changes according to tab |
| |
| |
| |
-----------------------------------------
| | | | | |
| | | | | | < tab bar
| | | | | |
-----------------------------------------
Instead of attaching to view controller, create the view in appDelegate or a singleton instance of the view and whenever a new view is pushed/switched, this view is moved to the front by writing
[self.view addSubview:_yourStaticView];
in the view did load methods of each view controller class. A single UIView controller has a stack, so it cannot render multiple views at the same time, it's either one or the other. Whenever you want to remove this view, write:
[_yourStaticView removeFromSuperview];
You can change the contents of this view just as you would with a UIView!

Programmatically add textview and label to nstableView using Cocoa

I have a NSTableView with multiple rows and just 1 column.
I want to display table in following format:
----------------------------
| Label - 1 |
| |
| textxtview contents-1 |
| height 20 |
----------------------------
| Label - 1 |
| |
| textxtview contents-1 |
| height 40 |
----------------------------
The height of text view should be fixed and its scrollable
Label & text view text color should be different.
How do I programmatically add labels and textview and set the frames?
You maybe should take a look at NSCollectionView. That's easier to use as you can design the cell view in Interface Builder.