3

Move a view when you move a button

 3 years ago
source link: https://www.codesd.com/item/move-a-view-when-you-move-a-button.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Move a view when you move a button

advertisements

I'm writing a custom UIButton that can draggable around the screen. When I press this button, a uiview will bee added into superview. I've adding pan gesture for this view so it's can draggable too. And now I wanna make both uiview and button can draggable at the same time. How can I do that?
For example:

  • If I drag the uiview or the button to a point, the other will move too. You can see the picture below for more information.

I would encapsulate the button and the view in a parent transparent UIView. Add the pan gesture to it and move it around... both will then move.

Related Articles

Switch the view when you press the button

I want to change view when I press a button. in the root view .h i have this: @interface MainViewController : UIViewController -(IBAction)switchToMap; @end and in the .m I have this: -(IBAction)switchToMap { CustomViewController *customViewController

How to switch to the next view when you press the iPhone button?

here is a iPhone programming beginner's question: How do I get to another view by pressing a button in my main view? I have the following function which is executed when I press a button, and debugging it, he passes there, but my "Warning" view

IE, CSS: How to remove a highlight that appears when you click the button

Take a look at this page in IE (I have the newest version, but it also happens in older versions.) http://tinuska.vibraflex.cz/ In above link there are two round buttons at bottom of the page. When you click the button, a semi-transparent highlight a

Make a photo when you press a button

I'm a newbie when it comes to building apps. Is there any way to make an image appear when a button is pressed? I already have the button displaying text on a label when pushed. Here is my code for the button: - (IBAction)ClickMe:(id)sender { _result

How to display the activity indicator when you press the button to download the next view or web view?

when i click on button which title is click here to enlarge then i want show activity indicator on the first view and remove when load this view. but i go back then it show activity indicator which is shown in this view. in first vie .m file i have u

Does not the activity go to the next activity when you click a button in Android?

I am trying to move from one activity to another activity by clicking to the ImageButton. But when I click to button, it doesn't move to the activity which I specify in the code, and even it does not throw an error. I'm not getting where is problem H

UITableView reload data when you click the button

I want to reload the data from uitableview when I press the button. example: if I press button 1, then I will present data with id 1, and if I press the button 2 then I will present data with id 2 and previous data are not shown. Anyone know how, I u

Keep UIKeyboard with a view when you return iOS 7

I have a view controller that can be popped with the new interactivePopGestureRecognizer. If there is a keyboard present and the swipe animation begins the keyboard does not move with the view. I have had a look at this question and implemented it li

Add child views when you scroll (expand) AdapterView

I am creating a scrolling panel with many child views (e.g. buttons). Each child view has a fixed location based on their row and column index. I cannot create them at the beginning since there are tons of them and I will run out of memory, so I'd li

How to add sound when you click a button in xml

I want to code a button to make a sound when you tap it. If I were to have a sound file like test.ogg or test.wav how could I pull that off? I'm somewhat new to xml so be kinda descriptive. Thanks!You can use android:onClick="sendMessage", and m

Continually increase the integer value when you press the button

I'm new to Android so sorry if the question is easy to answer. I have two buttons, a decrease and an increase button, and in the middle of them a TextView which displays a value. When I hit the decrease button, the value in the TextView decreases and

Get a dialog box when you click the button

Can anybody tell me, how to get a dialog popup (ColorPickerDialog) when i click on Button. Code from comments: Button color = (Button)findViewById(R.id.color_button); color.setOnClickListener(new View.OnClickListener() { @Override public void onClick

Android: Adding an EditText programmatically when you press a button

I am working on an SMS application. I have a "+" button so that when user clicks that button a new ExitText will appear under the existing one for user to enter multiple phone numbers to send the text. Can anyone please help with creating a new

How to add a new row to a data grid (WPF toolkit) when you click a button outside DataGrid

I want to add a new row in the datagrid when click on a button in the outside of a datagrid. The datagrid is bound with SQL Server database, and it have some data at runtime I want to add new data to the database through the database I tried a lot, b

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK