how to give horizontal paging in blackberry - blackberry

-Display the first 3 images in 3 views on the Screen that are visible to the user (e.g. <-- img1 img2 img3 -->)
-Keep a record of what's on display..
-When a user scrolls left or right the next/previous image in the array is displayed.
E.g scrolling right once will give me ( <-- img4 img5 img6 --> )
and so on...and also img click events

Since API 5.0 there is PictureScrollField which looks like does what you need. On a pre 5.0 OS you'll have to code your own custom component.

Related

Constraints UIImage stretched and alignment

I am very very new to constraints, I have always had an issue with them. I have a logo, 2 text feilds and a button, what I am trying to do is get them to be placed in the same spot regardless the size of the device (centered and middle top position) I tried adding the missing Constraints but it stretched out my image and everything is getting massive on iPads and the look not to be in the same position. I have attached screenshots, I have also created an example app with the one scene.
[![enter image description here][1]][1]
[![enter image description here][2]][2]
What am I doing wrong? Why are these so hard?
I have tried what matt suggested and the end result was this....the logo covers everything, but I get errors now :(
[![enter image description here][3]][3]
[![enter image description here][4]][4]
[![enter image description here][5]][5]
[1]: https://i.stack.imgur.com/81Isa.png
[2]: https://i.stack.imgur.com/qLZcj.png
[3]: https://i.stack.imgur.com/NYqjQ.png
[4]: https://i.stack.imgur.com/w08GS.png
[5]: https://i.stack.imgur.com/CKwh8.png
Use Stack Views to place all the elements vertically.
Then make your stack view centre vertically and horizontally within the container/superview.
Lastly, make stack view top, bottom, leading, trailing anchors greater than equal to zero, so that it never goes out of the screen bounds.

Is there any way to do change the look of slider ? move slider at different positions with image change

hi this is an image i attached. Actually i want to build a system in which i want to move the car button (showing in image) to different specified positions(showing on the right) and at each position i want to replace the car image with different one(like truck, train). is there any way to do this ?
Link to the image:-
https://drive.google.com/file/d/0B-TGzvOW0sr9Wlk3T25DYWZlOGs/view
yes there is always a way to do it :-)
so create a UIView subclass which has two UIImageViews. 1st UIImageView can be the horizontal line. and the second UIImageView can be the with the car. you then move the UIImageView horizontally as you wish and set different images while changing the position.
edit:
1. moving an UI element can be done with resetting the frame of UI element.
for example if an image was at position (x,y, width, height) and you want to move 20 points to the right then it will be (x + 20, y, width, height)
if you use auto layout then you can just change the constant of your x-constraint in this case.
edit 2 :
you can use (Tap/Pan) Gesture recogniser. you will get the exact position and as well as the velocity with different state (gesture started/ended/changed).

Background is black in image.clipTo in Fabric.js

I am in the process of making a Fabric.js based application that users can upload images and make posters. Recently I started work on a clip function to crop images using a path drawn by the user.
How it works: User selects an image from the canvas and clicks on a crop button. The activeElement is choose from the canvas, its image src is extracted. This SRC is used to place an image on a canvas on a Bootstra Modal. The user clicks on the image where a path will be drawn and finally crops the image.
Once the crop button is clicked, a SVG path is made from the dot points. Then this value is used to crop the image.
Issue: If the image is a PNG with no background ( we only use PNGs ), it will make the background 'black'.
Below, #_path refers to the fabric. Path object created using a svg path by user clicks. #_image is image fabric.Image.
clipPath: () ->
path_x = #_path.getLeft() - ( #_image.getWidth() / 2 )
path_y = #_path.getTop()- ( #_image.getHeight() / 2 )
#_path.setLeft path_x
#_path.setTop path_y
# console.log 'Fill white'
# #_image.setFill('white')
#_image.clipTo = ( ctx ) =>
#_path.render( ctx )
#_image._clipToPath = #getPathSVG()
#_canvas.renderAll()
return
I tried #_image.setFIll('white') and #_image.backgroundColor = 'rgba(255,255,255,1)' but doesn't seem to be having an effect.
Questions:
Have I clipped/cropped the image the correct way ( ie: using clipTo )? Why do you think
Why do you think the image is black where there was trnsparency?
Thanks in advance.

Is there an easy way to cut a slice from an image using Gimp?

Wondering if there is an easy way to remove a rectangular slice across the entire width of an image using Gimp, and have the resulting hole closed up automatically. I hope that makes sense. If I select a slice across an image and do "cut", it leaves a blank "hole" there. I want the new top and bottom of the image to join and fill that hole, reducing the image height by the amount sliced out.
Any easy way to do this?
Here is a method that is quick and often does what you want:
Cut out the middle, leaving a transparent "hole".
Click anywhere to remove the selection (so the hole is not selected).
Click Image > Zealous crop .
This is going to remove the middle part. However, if you also have transparency in other parts of the image (like around the edges) it's going to remove that transparency too.
I believe you're asking to do something like cut out the middle of a page, leaving the header and footer and have the blank space removed with the cut action, effectively joining the header and footer together.
To my knowledge, I don't believe so. Even if you cut, or delete, that space is still part of the image even without content.
But, you would be able to highlight the top or bottom (or left or right) of the remaining space and drag it to align with the other side. It's not ideal for repetitive tasks, but should get you through if you only have to do it a few times.
Install Python and the Python Imaging Library. Back in GIMP, select and cut the full-width areas you don't want to transparent, and export the image to test.png. Then use this Python code (works only if complete lines are transparent; will not work properly if there are 100%-transparent pixels anywhere other than on a full-width row)—
from PIL import Image
i = Image.open("test.png")
b = i.tobytes()
b2 = ''.join(b[n:n+4] for n in xrange(0,len(b),4) if ord(b[n+3]))
newHeight = len(b2)/i.width/4
i2 = Image.frombytes('RGBA',(i.width,newHeight),b2)
i2.save("test.png")
Then re-load test.png and verify that the areas you cut have gone.
In gimp 2.8.1 you can easily create a new image from a selection. So if you select a rectangular than do a copy (Ctrl-C) and a past in a new image
Edit -> Paste as -> new image (or Ctrl-Shift-V).

Tabular display of images

I am very new in Iphone development.
I have a requirement to display images in a tabular form [row column wise].
---------------------------------------
| Img1 img2 img3 img4 |
| Img6 img7 img8 img9 |
---------------------------------------
Will you please inform me the best way to accomplish this.
Thanks in advance.
Suhas.
You can go for multi column grid table view layout , where you can define each and every row and column.
you can check this tutorial for Drawing a Grid in a iPhone UITableView – Tabular Cell Data
http://usxue.is-programmer.com/posts/14176.html
http://www.iphonedevx.com/?p=153
You should look into using a UIScrollView for this. Set the contentSize accordingly to your needs.

Resources