selector

Pressing UIButton results in Unrecognized Selector error

不羁的心 提交于 2019-11-29 17:04:51
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 0x5a29d80 2011-09-02 15:27:13.365 blubb[15006:207] * Terminating app due to uncaught exception

UIBarButtonItem selector not working

一曲冷凌霜 提交于 2019-11-29 17:01:26
I have a MainViewController embed in a Navigation Controller, as shown below: And in MainViewController.swift, I added two UIBarButtonItem(left and right) programmatically: class MainViewController: UIViewController { let rightButton = UIBarButtonItem(title: "Right", style: .plain, target: self, action: #selector(onRightClick)) let leftButton = UIBarButtonItem(title: "Left", style: .plain, target: self, action: #selector(onLeftClick)) override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItem = rightButton navigationItem.leftBarButtonItem = leftButton } override func

Android: how to use selector?

我的未来我决定 提交于 2019-11-29 17:00:34
I have a problem of using selector that it does not work as what I expect. I wanna click on it then it gives me reaction and I select it(By long click but I probably do it through programmatic way) then it gives me another reaction. However, it reacts nothing in result.... reaction part: <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="10" android:padding="5dp" android:background="@drawable/border_bottom" > <LinearLayout android:layout_weight="9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation=

Swift unrecognized selector sent to instance error

北城余情 提交于 2019-11-29 16:41:53
I recently converted my project from Objective-C to Swift and in doing so I acquired this error whenever I click a button in the table view's cell. I have multiple cells being filled with information from a mysql server. I have two buttons, a follow button and followed button, when one is clicked the other is supposed to show. I've been working on this for a while but I've been stuck on this error. Error I'm getting when I click the button in the tableview CustomCellSwift[1425:372289] -[CustomCellSwift.ViewController followButtonClick:]: unrecognized selector sent to instance 0x100b13a40 In

Obj-C introspection: How can a method reference its own selector?

半城伤御伤魂 提交于 2019-11-29 15:22:48
I wish to write a macro, to be used within any method, which references the method's selector. I do not wish to pass the literal name of the method. For example: #define RERUN [self performSelector:{something} withObject:nil afterDelay: 0.0] where the "{something}" in the above would resolve to the selector of whatever method the macro was used in. Is there some way to do this? _cmd represents the selector of the current method -- it is a hidden argument (like self ). if you never need arguments, or nil is suitable for your purpose - all you need to do is write: #define RERUN [self

Is ID selector faster than class selector when it is cached in jquery

╄→гoц情女王★ 提交于 2019-11-29 14:57:26
I know that ID is a faster selector than class in Javascript. But what if I cache the selector? When the selector is cached, would it differ in speed if it’s a class selector, or will it be as fast as the id selector? Example: <div class=”myclass”></div> <div id=”myid”></div> var $myclass = $('.myclass'); var $myid = $('#myid'); Will $myid be faster than than $myclass? You have those stored in variables. So the speed will be the same for both. The performance hit will occur when you are iterating DOM to get elements. At that time ID selector will be faster than class selector. The cached

CSS *only* detection of text overflows in HTML?

天大地大妈咪最大 提交于 2019-11-29 13:23:00
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:1px solid black } .smart-warning:overflowing { border:1px solid red } </style> It seems like we'd be

Disable Android GridView highlighting completely (disable selection)

我的未来我决定 提交于 2019-11-29 12:22:41
问题 I'm trying to disable the highlighting of objects in a GridView in Android 2.2. I found this other answer saying that I should set the selector to a transparent ColorDrawable ( android:listSelector="@android:color/transparent" ), but the views in my GridView are still dimmed when I select them. I'm just using the GridView to display static objects in a grid. None of these objects will be selected. Would it be better to just use a basic view and draw my images manually? 回答1: Ok, it looks like

Is there something like a “CSS selector” or XPath grep?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 11:44:38
问题 I need to find all places in a bunch of HTML files, that lie in following structure (CSS): div.a ul.b or XPath: //div[@class="a"]//div[@class="b"] grep doesn't help me here. Is there a command-line tool that returns all files (and optionally all places therein), that match this criterium? I.e., that returns file names, if the file matches a certain HTML or XML structure. 回答1: Try this: Install http://www.w3.org/Tools/HTML-XML-utils/. Save a web page (call it filename.html). Run: hxnormalize

iOS - UITapGestureRecognizer - Selector with Arguments

好久不见. 提交于 2019-11-29 11:44:35
问题 In my app I am dynamically adding images to my view at runtime. I can have multiple images on screen at the same time. Each image is loaded from an object. I have added a tapGestureRecongnizer to the image so that the appropriate method is called when I tap it. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)]; [plantImageView addGestureRecognizer:tapGesture]; My problem is that I don't know what image I have tapped. I