Zooming Entire ScrollView - ios4

I have a series of PDFScrollViews (like the one given in the sample code on Apple Developer) inside a UIScrollView but I want them to all scroll at once no matter where in the ScrollView the Pinch-Zoom action happens, currently this only happens to the one PDFScrollView that is pinched and the other stay the same size. The basic goal I'm trying to achieve here is to make a series of PDFs act as one homogeneous PDF to the user.

implement scroll view's delegate method
-(UIView *) viewForZoomingInScrollView: (UIScrollView *) ScrollView
And return your PDF view.
hope it 'll work

Related

Making and Object uniteractable

So I have a part of my game where the character is selecting an area of the map. And it opening up a panel. I have made it so that happens but an=m now stuck on the other part of it. I want only certain area of the map to be intractable, so that I can bar the player from selecting areas of the map that they aren't ready for. I have no idea how to make game objects in the game uninteractable. I have looked on Stack overflow, Youtube an d the Unity API to no success. Can someone help me with that.
How to make things un-interactable will vary depending on your situation. I'll be presuming that you're map is broken up into a grid of sorts.
The basic setup would involve a bool, probably called 'CanAccessZone'.
Then you'll need a class, to store any access info and popup logic, by popup logic I mean make the element either non-interactable or show a popup, with the shown popup being dependant on 'CanAccessZone'. This class can then be set up by your Map class when the level is loaded, or you could let the popup class grab the necessary values from the Map class.
If you're using Unity's UI buttons for the map pieces, then you could set interactable to false, until you want to let the player access the zone. If you want to display a popup informing the player that they can't access the zone, then your button will be interactable, but the click will delegate to your popup logic method.
It's a similiar principle if you're using gameobjects as buttons. You'd be using any of the OnMouse events to handle click events. https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Hopefully this'll lead you in the right direction.

how to set lwuit textarea scrolling false

I want to add large string content to a container dynamically.
There are 60 different contents(strings) to be displayed in this container.
To add the string to container, I am adding a TextArea(empty border with 100% transparency).
The problem is that TextArea offers scroll and I do not want it to scroll. Instead I want to grow(increase height) according to content. I am unable to achieve this.
Can you help me out with this?
Or can I use any other component for the purpose?
I am using LWUIT with J2ME.
You can derive text area and return false for isScrollableY() although it should generally work seamlessly even if you don't do that (since your parent layout is scrollable). Is it possible you changed the text area and don't revalidate the parent form on the EDT?
There are problems with text area layout when it is modified by a separate thread (race condition with the layout code).
First put the TextArea.setSingleLineTextArea(false) , and grow by content true.

show popovers on uilabel touch in iphone

I have a number of UILabels on a single view of a iphone application ios 4.3. How to handle touch events for all these labels at one time? I wanted to show pop overs on touch of that label. I know popovers are not available on iphone and will be making my custom ones.
what i did was using UITapGestureRecognizer and adding an action #selector(labelTap:) and then doing [label addGestureRecognizer:TapGestureRecognizerObject. But when i use the same UITapGestureRecognizer for all my UIlabels only the last added label shows the tap action.
i have set userInteractionEnable to YES.
Can any one point me to the right direction?
You need to create separate UITapRecognizer for tracking different UILabel, when a UIGestureRecognizer is added to multiple views, it will only track event from last it added to. To better understand why you need different instances of UITapRecognizer, think of it as a UIView that only handles touches event but doesn't do any drawing.

How place the components the front of another one?

I want to place the components A and B over component with List. I need that would text of list will be to visible. I can not find which layout can do it.
How this behavior is in lwuit? What solutions exist?
The question is somewhat unclear, jmunoz answer is correct if you want component's A and B to reside at the bottom of the screen and the list to scroll above. However from the drawing it seems you want an "always on top" effect which you can achieve either via a glass pane (for non-interactive components) or via the LayeredLayout class.
This is actually quite simple using the following:
myForm.setLayout(new LayeredLayout());
myForm.setScrollable(false);
// will occupy the entire area of the form but should be scrollable
myForm.addComponent(componentUnderneath);
Container south = new Container(new BorderLayout());
myForm.addComponent(south);
south.addComponent(BorderLayout.SOUTH, whateverYouWantToPlaceOnTopInTheSouth);
You must do the following:
The Form must not do scroll. Use Form.setScrollable(false). Set the layout of the ´Form´ to BORDER_LAYOUT, myForm.setLayout(new BorderLayout()) . Ok in BorderLayoutyou can put the components in the Form as you want.
Put the Listcomponent in the center of the BorderLayout with myForm.addComponent(BorderLayout.CENTER, List) and the other two elements in the south of the layout using
Container southContainer = new Container();
southContainer.addComponent(A);
southContainer.addComponent(B);
myForm.addComponent(BorderLayout.SOUTH, southContainer)
With this you can get a scrollable Listand two elements always visible.

Monotouch: arrange the UINavigationController back button in a different position

How can I arrange (programatically) the back button of a UINavigationController in a different position?
For example, suppose that the back button (visible in the upper bar of a UINavigationController) has these coordinates: 67 for x and 10 for y. I would arrange the back button for these coordinates: 89 for x and 10 for y.
Do I have to override these measures in a specific method (for example viewDidLoad() method)?
Thank you. Regards.
I guess this cannot be done in a simple way as you can manipulate the navigation bar only via few properties. So there are basically two methods:
1) traverse the UI tree and search for the actual button control created by iOS for you in the navigation toolbar and change its Frame property. You can always get to the inner controls by the Subviews property, so call navigationController.Subviews and iterate through that until you find the control you would like to move, btw it could be deep in the hierarchy, depends. And with iOS update this can change, so this is a bit of a hack, but usually such technique works well.
2) do the custom way. Hide the actual navigation bar, and do the navigation yourself via custom buttons, add a UIButton to your interface, in the action for that call popViewController on the navigationController. If you're inside a view controller, you can use this.navigationController.PopViewControllerAnimated (...);
If you need nice buttons, use this PSD, works well for me http://www.teehanlax.com/blog/2010/06/14/iphone-gui-psd-v4/
Hope this helps. If so, please vote.

Resources