android button selector

You just need to set selector of button in your layout file. <Button android:id=”@+id/button1″ android:background=”@drawable/selector_xml_name” android:layout_width=”200dp” android:layout_height=”126dp” android:text=”Hello” /> and done. Edit Following is button_effect.xml file in drawable directory <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/numpad_button_bg_selected” android:state_selected=”true”></item> <item android:drawable=”@drawable/numpad_button_bg_pressed” android:state_pressed=”true”></item> <item android:drawable=”@drawable/numpad_button_bg_normal”></item> </selector> In this, you can see that there are 3 drawables, you just … Read more

How to get rid of the ‘undeclared selector’ warning

Another option would be to disable the warning with: #pragma GCC diagnostic ignored “-Wundeclared-selector” You can place this line in the .m file where the warning occurs. Update: It works also with LLVM like this: #pragma clang diagnostic push #pragma clang diagnostic ignored “-Wundeclared-selector” … your code here … #pragma clang diagnostic pop

“unrecognized selector sent to instance” error in Objective-C

It looks like you’re not memory managing the view controller properly and it is being deallocated at some point – which causes the numberButtonClicked: method to be sent to another object that is now occupying the memory that the view controller was previously occupying… Make sure you’re properly retaining/releasing your view controller.

@selector() in Swift?

Swift itself doesn’t use selectors — several design patterns that in Objective-C make use of selectors work differently in Swift. (For example, use optional chaining on protocol types or is/as tests instead of respondsToSelector:, and use closures wherever you can instead of performSelector: for better type/memory safety.) But there are still a number of important … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)