selector

Pressing UIButton results in Unrecognized Selector error

有些话、适合烂在心里 提交于 2019-11-28 11:14:42
问题 I have a button in my UIView that is created like so: UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(toggleEdit)]; self.navigationItem.rightBarButtonItem = editButton; [editButton release]; And this is the action method: -(void) toggleEdit:(id)sender { } but I get this error 2011-09-02 15:27:13.362 blubb[15006:207] -[DatabaseSelectionViewController toggleEdit]: unrecognized selector sent to instance

“Press and hold” button on Android needs to change states (custom XML selector) using onTouchListener

杀马特。学长 韩版系。学妹 提交于 2019-11-28 09:03:47
I've got a button graphic which needs to have "press and hold" functionality, so instead of using onClickListener, I'm using onTouchListener so that the app can react to MotionEvent.ACTION_DOWN, and MotionEvent.ACTION_UP Depending on how quickly those two events are triggered, I can run a "pressAndHoldHandler" in the time between the two. Anyway, long story short: I have numerous "basic" buttons in the same app that don't require the press and hold functionality, so they are using the onClickListener. Every single one of these buttons have been customized graphically with their own XML

Can I make #selector refer to a closure in Swift?

三世轮回 提交于 2019-11-28 09:01:19
I want to make a selector argument of my method refer to a closure property, both of them exist in the same scope. For example, func backgroundChange() { self.view.backgroundColor = UIColor.blackColor() self.view.alpha = 0.55 let backToOriginalBackground = { self.view.backgroundColor = UIColor.whiteColor() self.view.alpha = 1.0 } NSTimer.scheduledTimerWithTimeInterval(0.5, target: self, selector: #selector(backToOriginalBackground), userInfo: nil, repeats: false) } However, this shows an error: Argument of #selector cannot refer to a property . Of course I can define a new, separate method and

Want to make the whole page in grayscale except specified div

拈花ヽ惹草 提交于 2019-11-28 07:47:05
问题 I have a css code that could make the whole page in grayscale. <style type="text/css"> html { -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); filter: grayscale(100%); } </style> I now want to embed an iframe inside a div that would not be affected. I have searched about the solution and fount :not selector. When I refer to 6.6.7 at http://www.w3.org/TR/css3-selectors/#negation I think i have found the solution because it may work even I put html as my css selector html|:not(x)

CSS *only* detection of text overflows in HTML?

狂风中的少年 提交于 2019-11-28 06:58:46
问题 I've seen suggestions on using JavaScript for detecting and acting on text that overflows an HTML element. But it's 2013, so I was wondering if maybe the CSS spec had a way to detect overflows itself. In other words if I have a fixed size div: <div class="smart-warning" style="width:200px; height:20px; overflow:hidden"> This is my very long text that would overflow the box. </div> I'd like to have a style that would do something if the text overflowed such as: <style> .smart-warning { border

Why does select() consume so much CPU time in my program?

大憨熊 提交于 2019-11-28 06:48:48
I have several Java applications that use MINA, and all of them use 20 MINA threads. One application serves around 10,000 concurrent connections, that are usually idle but receive input sometimes. 20 is likely a reasonable threadcount for that application, although I haven't exactly profiled it (which this question is getting at). Another application serves only around 15 connections at a time but initiates the IO work so they are very busy, and has 20 MINA threads anyway, which is obviously too many. The thing that's strange to me is both applications always devote about 30%, sometimes as

How do I select a sibling element using jQuery?

懵懂的女人 提交于 2019-11-28 06:41:16
Can you help me with this jQuery selector? $(".auctiondiv .auctiondivleftcontainer .countdown").each(function () { var newValue = parseInt($(this).text(), 10) - 1; $(this).text(newValue); if (newValue == 0) { $(this).parent().fadeOut(); chat.verify($(this).parent().parent().attr('id')); } }); Basically, I want to select the element with .bidbutton class that belongs in the same parent as the .countdown in the each loop: <div class="auctiondivleftcontainer"> <p class="countdown">0</p> <button class="btn primary bidbutton">Lance</button> </div> And then apply this to that button: $(button here)

Android: How to achieve the glow effect when long-pressing a list item?

一世执手 提交于 2019-11-28 06:35:22
With the default selector, long-pressing a list item causes its background to transition between two colors. Replacing the selector with the one below removes the effect. According to this question , I need an animation to reproduce it. How would I go about doing that in xml? <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape> <solid android:color="@color/state_pressed" /> </shape> </item> <item android:state_focused="true"> <shape> <solid android:color="@color/state_focused" /> </shape> </item

How do you stop a dropdown menu from going up?

随声附和 提交于 2019-11-28 06:02:05
问题 I have a dropdown menu that's towards the top of the page for most screen sizes, but on smaller screens, such as a laptop, the menu is in the middle of the screen, and because of this, the dropdown list is going above the selector. I want a dropdown that will consistently go down, no matter where on the page it is. Is this at all possible? 回答1: Drop-downs are rendered by the Browser/OS. You cannot control this type of behaviour using CSS or JavaScript. 回答2: As it's an element left to the

Android: set list view item as “selected” (highlighted)

℡╲_俬逩灬. 提交于 2019-11-28 05:33:14
In my application I want to do something similar to gmail app on tablets, in the left to have the list of items and in the right to have a fragment with the content of that item, like for gmail app this content is being downloaded after selection. After I click on an item I want it to remain highlighted until, of course I change the selection. I reached a point where this works but only if I click twice on the same item, so first I click, selection works and then the item goes back to its 'default' state and if I click again on it, the selector (for selected state) is visible. This is what I