Make part of the screen generate click events? - blackberry

In my application I have an ordered sequence of bitmaps where I need to flip them right to left and left to right, based on whether the user clicked on the left or right of the screen after the bitmap loads.
I need to implement the click event on the screen only after the bitmap is painted to the screen.

This is a very vague question. If you are using a Screen object and simply drawing the bitmaps by overriding the paint() method, you just need to also override the touchEvent() method and handle that. But without any code it's hard to give you specific advice.

Related

Dragging an uiview like facebooks menu slide

I know this has been probably asked before but I've seen many approaches and i don't know which is best for me, so plz don't send me a link to another post unless it addresses my problem directly.
I have a controller which has a uiview on the top (like a header) (this header is bigger than it seems because is partially hidden on top). on that view i have a uibutton which now with a touch up inside shows the entire header view and taping again returns it to its starting position (changing frame with animation). I want to also be able to drag the view but only changing position on the y axis(dragging up and down)... i was thinking of adding the dragInside/Outside event to the button but this doesn't give me the position of the finger... and also want to know when the user releases the drag so the view ends animation to any of its two possible states (showing or partially hidden). Is this a "touches began" , "touches moved" , "touches ended" thing? if it is please provide a code example. I also want to do this with another view but this is on the left side... same thing but this one moves on the X axis... any help is appreciated. or maybe it can be made with drag event if i only can save a CGpoint of last touch, maybe that's better, any other suggestions
Look at using a UIPanGestureRecognizer to detect the touch movements. Use the translationInView: of the gesture to set the view y position. The translation is the total movement since the start of the gesture so you don't need to remember and accumulate the offset position yourself.
The main thing to worry about while implementing this is bounding the y position of the view so that no matter how far the user drags the view won't go too high or low on the screen.
Use a UIPanGestureRecognizer, that's a class dedicated to handling such drag/pan gestures.
Everything is described here in Apple's documentation, including examples, so you should find your answer here.
There is also some sample code in Apple Developer Library that shows you how to use Gesture Recognizers if needed.

How to draw caret in the scroll view on iOS using system API?

I am working on an edit app, the view inherits from scroll view, and I draw most things manually. I need an insertion indicator, which may refer to caret(as I know windows use this term) or cursor(not the mouse cursor). I am not sure what term apple use.
I googled before and I know I can draw it as a line manually, or create a clear background text view over it, but I don't like these ways. I hope there are system APIs to do this, which is more native. Any one can figure out?

Receive UITouchesMoved on a newly added UIView

In an iOS program I use a UILongPressGestureRecognizer on a large view. Once the long press has been triggered, I remove the large view, and create another thumbnail view centered under my finger. To the user it looks as if the large view has shrunk to a thumbnail that can then be moved.
Once this new thumbnail is created under my finger, I want to be able to move it somewhere else. However, currently, in order to move it I have to lift my finger up and place it back down on the thumbnail in order to get UITouchesBegan/UITouchesMoved messages to be sent.
How can I ensure that UITouchesMoved start to be sent to the newly created view, without having to re-touch the screen? Or what other workaround should I use?
Is there a reason not to actually shrink the view, as this is the effect you seem to be after anyways? This would also enable you to easily use a short animation for this to get a "Apple-like" UX.
You cann't do it without touch up. When you down your finger to large view, then this view will receive all move events until you touch up finger.
But there is a one trick - your large view continues to receive events when you move your finger on the screen. You can get access to all new coordinates and set it to thumbnail. It will like you moving thumbnail but in fact you will interact only with large view.

iOS: Back toolbar bar button item

I need the back arrow toolbar bar button item.
In identifier of bar button item, there is play, refresh, reload, and stop.
I need the image of play, but flipped 180 degrees.
Is there a way to flip the image with code? If not, where can I find this image?
here's a simple work around:
declare your button with "initWithTitle" and set the title to #"◀" (it's just a unicode symbol).
Use #"▶" for the forward button to make it consistent.
I tried it and it worked for me.
Do a Google search for play button vector graphic. Make the one you want the image of the button. Should still be able to tell the button to maintain it's bar button style.
One straightforward option is to draw a white triangle of the appropriate size and orientation in an image editor, stick it in an image view, and then use that image view for a bar button item's custom view.
I wouldn't try to use the UIBarButtonSystemItemPlay image. I don't know if manipulating system images is expressly proscribed, but Apple generally doesn't smile on misuse of system items. When you get right down to it, it's just a white triangle, so it'd be hard to tell the difference between drawing your own or reversing theirs. That just seems like all the more reason to draw your own.

Blackberry pixel-specific animated focus scrolling

Suppose I have a VFM full of both focusable and non-focusable fields. Since most of them are spread out far apart, the movement from one focused field to another is jerky at best, even with NullFields in between. In other words, it just sets the current y position to the next focused field without smoothly scrolling the screen.
What I want to achieve is to be able to scroll at a fixed rate between fields, so it it doesn't just focus from one to another that instantaneously. After reading up on how to do this, it is a matter of overriding moveFocus and setting it via a TimerTask from an accessor method to set moveFocus, as per this link. However, I haven't seen a practical implementation of how to do this, complete with the routines that are called in the TimerTask's thread.
Is there any way to achieve this type of behavior?

Resources