xcode 4.5 UIBarButtonItem Action not responding, built in IB - xcode

I've set up a UIBarButtonItem in IB, created the IBAction by dragging from IB to the header file, then just put a simple breakpoint within the action in my source file....... and nothing happens.
I'm using AVCam. I can run the action from a button, but it needs to be done on a toolbar because I'm working with sharekit. I've made toolbars before, and have never had this problem before.
I connected both the toolbar and the barbutton's objects... those both work. I can hide and unhide them freely, but for some reason I just cannot get the action to call.
Anybody got any ideas?

I had a very similar problem with an UIBarButtonItem with outlets not working in Xcode 4.5 - no actions got send when I pushed the button, and the referencing outlet didn't reference to anything.
After some time and googling, I discovered that even more none of all the changes I made to my storyboard did have any effect, but hardcoding the GUI worked.
Finally, emptying Xcode project caches solved my problem - the description how to do this can be found here: How to Empty Caches and Clean All Targets Xcode 4

I had the same problem with Jeff.
For a long time, i tried lots of useless stuff.
Adding selectors programatically , bla bla bla
i also had an UITapGestureRecognizer added on viewDidLoad in order to dismiss keypad.
it was not letting gestures to reach UIView.
Not to UIBarButtonItem Click Event and many more
Not to UITableViewCell Select Event.
This solved my problem:
tap.cancelsTouchesInView=NO;
All of a sudden
UITableViewCell Select started to work
UIBarButtonItem Click event started to work.
My problem was occurring only (7.1)
Not in (8.1)

Related

Swift IBAction Issue With ViewController Swap OSX

I have 2 ViewControllers in an OSX swift project using storyboards. My aim is, when I click the button, the IBAction is called and the view also switches. However, despite my IBAction seeming to be good (I dragged it on and did println("hi")) "hi" is not printed, but the viewcontroller is changed. I would think it were an XCode glitch if I didn't know better, but for the life of me I can't think of what I'm doing wrong. Is anyone able to replicate this?
Can you paste the ViewController code? Is this the first time you hooked up an IBAction to that button? There might be an existing connection in the connections inspector which you haven't closed out yet?

keyboard not appearing when clicking iOS input text field/view no matter where I put them

Hi all for some reason in my iOS project on the latest Xcode6 the keyboard is refusing to appear anymore when I click inside a input textfield or textview.
I did have one of my fields dismissing the keyboard via
.h
IBOutlet UITextField *textField; {
}
- (IBAction)dismissKeyboard:(id)sender;
.m
- (IBAction)dismissKeyboard:(id)sender {
[textField resignFirstResponder];
}
but even when I delete this code, even tried deleting the view controller files & storyboard and have tried dragging the input textfield/view onto my other view controllers/views and still it refuses to appear no matter where I put it!
Also tried doing a clean, restarting Xcode and the Mac itself.
At the moment I don't even have any custom code in my controller file .m or h.
Apart from restarting the project I'm not sure how I get this default behaviour of the keyboard appearing when clicking inside an input back!
The only thing I have been doing in my other storyboard view controllers is experimenting with constraints/autolayout.
Scratching my head, apart from starting a new project file I'm not sure what to do, any help would be great
Boss, Go to Simulator-> select Hardware -> go to keyboard -> and then do toggle keyboard.It works.Cheers

NSControl does not work on different Mac

I encountered a very strange problem which I can't solve by myself. I have several UI elements embedded in a NSWindow running as NSBorderlessWindowMask. There are 2 NSSlider, 3 NSButton, a NSComboBox and a NSColorWell.
The application builds for target 10.7 and has sandboxing enabled.
On my development machine every element works as intended. The NSComboBox has a working DataSource and Delegate. The NSColorWell does work too. When I click into the NSComboBox, I can type a text into it. And the NSColorWell opens a color selection.
The moment I hand my app to my beta-tester, the NSComboBox and the NSColorWell can't be edited. This means, that I can add elements to the DataSource of the NSComboBox (via an import) and they may be selected in the dropdown menu, but I can't click into the NSComboBoxCell and write a text. Also no color selection opens when I click the NSColorWell.
I have no clue at all what could cause this behavior. Every element is hooked up correctly and I run the same binary as my beta-tester. The systems both run Mountain Lion in its latest version. I tried creating a NSButton for the beta-tester which runs following methods on the NSComboBox:
[self.nameCB reloadData];
[self.nameCB setEnabled:YES];
[self.nameCB setEditable:YES];
[self.nameCB setNeedsDisplay:YES];
[self.nameCB setFrame:self.nameCB.frame];
[self.nameCB becomeFirstResponder];
[self.nameCB setSelectable:YES];
None helped. I have no clue how to "debug" this behavior. Do you have any suggestions?
Edit: I was able to break it down a bit. When I remove the line
[self.window setStyleMask:NSBorderlessWindowMask];
It works. But I want to get a nice look from removing the titlebar, so it only helps a bit.
As I already edited into my question I found out that this problem is caused by the NSBorderlessWindowMask style on my main NSWindow. I found no other way around it than subclassing NSWindow.
I used this example as a guide. It also works if you just extract the CustomWindow class from the project and add it to your project. Then just set the class of your window in IB to the CustomWindow
I still don't know what caused this problem. If anybody has an idea feel free to leave another answer below please.

UITableView no longer scrolling using xCode 4.5, deploying on 5.x or 6.0

Deployed project using UITableView for display of images.
Upgraded to xCode 4.5, suddenly my UITableView no longer scrolls.
This occurs both on the device and on the simulator with iOS 5.0 -> 6.0
Additionally, I have found that I can no longer set the number of minimum touches for the PanGestureRecognizer programmatically.
Other StackOverflow ticket
In fact, a Zombie analysis reveals that the recognizer has been released. This could definitely explain the above behavior. My attempt to set the recognizer is as follows and crashes.
UIPanGestureRecognizer* pgr = [imageTableView panGestureRecognizer];
[pgr setMinimumNumberOfTouches:2];
[pgr setMaximumNumberOfTouches:2];
Is anyone else seeing this issue?
I had a similar problem when moving to iOS6/XCode 4.5. It seems that the UIPanGestureRecognizer now steals touches from underlying UIScrollViews or UITableViews.
I found a work around for this in the post below. It's not the top rated answer, so I'll re-paste the content below as well:
iphone - UIGestureRecognizer prevents UITableView from scrolling in Xcode 4.5
I had the same issue: I used to drag my TabGestureRecognizer directly onto the storyboard instead of creating them through code. With iOS6 this now seems to break scrolling.
I prefer adding views, gestures, etc directly onto the storyboard instead of through code.
You can still do this but with two changes:
1) Referencing Outlet Collections
Right-click the GestureRecognizer which is visible to you within the scene's dock.
Clear the section Referencing Outlet Collections
2) Attach the GestureRecognizer to the related view through code
Create an outlet for your GestureRecognizer
Add the following line within the viewDidLoad method:
[self.tableView addGestureRecognizer:_tabGesture];

iPhone simulator not responding when using storyboards

I'm quite new to iOS Programming. I've done Objective-C for about a year, and now I want to start making apps for the iPhone. I think I'm missing out on something really simple, though. What I've done is this:
First I created a new Single View Application with TestApp as a product name. I enabled Use Storyboards, Use Automatic Reference Counting and Include Unit Tests. After creating the project, I dragged a UIButton onto the View in the storyboard file.
Note that I didn't write a single line of code. I launched my app in the iPhone Simulator and pressed the button, but it's not responding. I know I didn't assign an action to the press of the button, but the gradient of the button isn't changing, as I know it should. The User Interaction Enabled properties of both my view and my button were enabled.
Recently, I've created a few apps in Xcode that worked just fine, but I didn't use storyboards in those projects. Thus, I'm guessing there's something extra to do when using storyboards of which I'm just unaware. I'm using Xcode 4.5 and the iPhone 6.0 Simulator.
I wrote NSLog(#"View was loaded."); statement in the viewDidLoad method of my ViewController to make sure this view controller was actually loaded. (I know my button wouldn't show up if it was the wrong view controller, but I did this just to make sure.)
I also wrote a changeTitle: method in my ViewController to change the title of my button to New Title after it was pressed, just in case the button worked but its gradient just wouldn't respond to a tap. I linked this IBAction to my button, but it wasn't called.
In my ViewController, I created an IBOutlet of a UIButton which I connected to my button. In the viewDidLoad method of my ViewController, I changed the title of my button to New Title, this actually worked. The title of my button changed to this new title when launching my app in the iOS Simulator. The button itself still wasn't responding, though.
As a last try, I also wrote [button setEnabled:YES]; in my ViewController's viewDidLoad method, but this didn't help. My button still doesn't respond to any tap. What am I missing out on?
This is weird. I had an issue with my printer, so I restarted my computer. After this, this issue was suddenly solved as well (just like my printer issue). I'm not sure how this could have affected anything, but I'm glad it works again!
Ran into the same issue.
Apparently Content Reseting the Simulator worked for me
Very strange this..

Resources