How to get picture directly once we capture it? (Without usephoto/cancel step in the middle) (iOS 7) - uiimagepickercontroller

Generally we use UIImagePickerDelegate to get the selected image from user. I need the image after the user captured it without asking usephoto/ cancel. Is it possible?

Step 1 : Remove default camera controls by this method.
[pickerController setShowsCameraControls:NO];
Step 2 : Create an Overlay view and put one button on the overlay view to capture image.Set the view as picker controller's overlay view.
[pickerController setCameraOverlayView:camOverlay];
In the button action write this method:
[pickerController takePicture];
This automatically calls the delegate method and we will get the image directly with out use photo or cancel Step.
NOTE: Source type of picker controller should be camera to implement the above stuff.
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
set delegate to self.

Related

how can i implement drag and drop in urho 3d view?

I have added 3d view objects using urhosharp for my xamarin uwp/ios/android project . The only event that work is touch event, but i also want to use drag and drop so that the objects can move to different locations within the 3D view. Any suggestions?
https://us.v-cdn.net/5019960/uploads/editor/ni/u16pg79v2m62.png
Haven't used urhosharp yet , but here are some suggestions about using of drag and drop, not sure if it helps here for you.
urhosharp: Basic Actions
From document of urhosharp , there is some bascic actions explains,but no drag and drop in it.Maybe you can do it by combining actions and drag methods on each platform. But this requires you to try.
UWP: reference link here
Here's an overview of what you need to do to enable drag and drop in your app:
Enable dragging on an element by setting its CanDrag property to
true.
Build the data package. The system handles images and text
automatically, but for other content, you'll need to handle the
DragStarted and DragCompleted events and use them to construct your
own data package.
Enable dropping by setting the AllowDrop property to true on all the
elements that can receive dropped content.
Handle the DragOver event to let the system know what type of drag
operations the element can receive.
Process the Drop event to receive the dropped content.
Code example:
<Grid AllowDrop="True" DragOver="Grid_DragOver" Drop="Grid_Drop"
Background="LightBlue" Margin="10,10,10,353">
<TextBlock>Drop anywhere in the blue area</TextBlock>
</Grid>
private void Grid_DragOver(object sender, DragEventArgs e)
{
e.AcceptedOperation = DataPackageOperation.Copy;
}
IOS: reference link here
With drag and drop in iOS, users can drag items from one onscreen location to another using continuous gestures. A drag-and-drop activity can take place in a single app, or it can start in one app and end in another.
Use drag items to convey data representation promises between a source app and a destination app.
Adopt drag interaction APIs to provide items for dragging.
Adopt drop interaction APIs to selectively consume dragged content.
Demonstrates how to enable drag and drop for a UIImageView instance.
Code of example:
func customEnableDragging(on view: UIView, dragInteractionDelegate: UIDragInteractionDelegate) {
let dragInteraction = UIDragInteraction(delegate: dragInteractionDelegate)
view.addInteraction(dragInteraction)
}
func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] {
// Cast to NSString is required for NSItemProviderWriting support.
let stringItemProvider = NSItemProvider(object: "Hello World" as NSString)
return [
UIDragItem(itemProvider: stringItemProvider)
]
}
Here is a sample for Xamarin IOS.
Or you can using UIPanGestureRecognizer in IOS to move view.Here is Walkthrough: Using Touch in Xamarin.iOS.All you need to do is let view.center follow panGesture to change.
Android: reference link here
With the Android drag/drop framework, you can allow your users to move data from one View to another using a graphical drag and drop gesture. The framework includes a drag event class, drag listeners, and helper methods and classes.
There are basically four steps or states in the drag and drop process:
Started:In response to the user's gesture to begin a drag, your application calls startDrag() to tell the system to start a drag.
Continuing:The user continues the drag.
Dropped:The user releases the drag shadow within the bounding box of a View that can accept the data.
Ended:After the user releases the drag shadow, and after the system sends out (if necessary) a drag event with action type ACTION_DROP, the system sends out a drag event with action type ACTION_DRAG_ENDED to indicate that the drag operation is over.
Table. DragEvent action types:
Or in Android can use onTouchEvent to move view, need to calculate position of the view.Walkthrough - Using Touch in Android
The main thing is to handle pressing and moving two messages, overloading onTouchEvent. Mathematical knowledge (translation): Record the coordinate point when ACTION_DOWN, and calculate the translation amount according to the current position and the position when pressed at ACTION_MOVE. Refresh the control, causing the control to redraw, and move the coordinates of the upper left corner of the drawing when redrawing.
Here also has a discussion about Drag & Drop in Xamarin forms.It may be helpful.

WKInterfacePicker: handle a tap event

Trying to simplify the UX in a Watch application by getting rid of a redundant button which a user has to tap in order to choose a selected item in WKInterfacePicker and perform a next step. Just want to replace the tap on this button with the tap on a picker.
Cannot find such API in the class specification and the following quote haunts me:
The user interacts with a picker by tapping it, using the crown to scroll through items, and tapping again to select an item.
Everything points to the fact that an item can be selected by tapping on a picker and we can get an access to that action programatically. Has anyone faced this task?
To handle focus to picker did tap event use - pickerDidFocus.
If you want handle each tap now there are only one custom way. You need every time did focus picker programmaticaly call [picker resignFocus]
Put picker into group and set background border image to it if you want to customize focus. Set picker focus style to none.
just add a picker to your WKInterfaceController and create an IBAction to react on the pitch events:

How to identify the viewcontroller is clicked from More Tab or Separate tab in UITabBarController?

I have the navigationcontroller based viewcontroller and I overriding the root view controller navigation bar back button in to my custom segment control with different purpose. This navigation controller is placed one of the separate tab in the uitabbarcontroller. If this is used as the separate tab bar then no problem.
But if i use this navigationcontroller inside the more option in tabbarcontroller i am not able to come back to the more option list because of backbutton is overridden in my navigationcontroller.
My idea is add one back button only if my navigationcontroller is used more option tab otherwise i need to hidden the back button.
Please help me in this issue?
You can check if a view controller is in the 'more' section as follows:
BOOL isOnMoreNavigationController = [tabBarController.moreNavigationController.viewControllers containsObject:myViewController.navigationController];
From a UI consistency perspective it might be better to always show the back button in its standard position and move your custom buttons to some other place.

Trigger Gallery OnFling without GUI Input

How can you trigger an onFling() without the user actually touching the device?
Actually my need is a little different than that. I have a horizontally-scrolling Gallery, and below that is a row of buttons. I want the user to be able to advance the gallery to the next View just by tapping a bottom-row button. Let's call this method next().
I envision calling the next() from the OnClickListener.
As it happens, there is a method available to Gallery. It is setSelected(int index).

How to change a View from inside a view

I have one .mxml file (the Application) with a ViewStack (with 4 views) and a ControlBard, obviously I can change the views with it, but what I want to do is: in view #1 I have an image which I want to convert to a "hyperlink", so when I click it I go to View #2, is this doable? Also I would like to pass somehow some data (like a String) to that View #2 (lets say the it's a user avatar I click so I want to go to the second view which will show me his profile, that's why I need his name/id).
One way, loosely coupling, Create a custom event (SelectAvatarEvent?) with a property for name/id and dispatch it from View1 when the link is clicked. In the Application add an event listener for this custom event, and catch it, change the view index to View2 and create a function/property in View2 that you can pass the string/event to. Depending on how it is implemented, might need to account for delayed instantiation of View2.

Resources