Delete UILabel from Storyboard - xcode

How can I remove a UILabel from storyboard in XCode? I mention that I use UIKit framework.
I'm looking for a "delete" button but I can't find it.

You should click the label and then use the keyboard's [Backspace] button. It's above the [Enter] button.

Select the button in the canvas view or in the document outline. Then press the delete key on your keyboard or, from the menu bar, choose Edit > Delete.

Related

How to add tooltips to NSButtonCell that is within a NSMatrix

I am currently instantiating an NSMatrix w/ NSButtonCell subclasses through IB
I use the identity inspector to change the Tool Tip property
But the tooltip doesn't show on the button cell.
If I set a tooltip on the NSMatrix object, a tooltip still doesn't show
If I add an NSButton to the same view, and add a tooltip to that, it does show
Why won't my tooltips on NSMatrix or NSButtonCell show?
I don't know why it can not be set in the Interface Builder (It seems like a long standing issue), but you can set them at least programmatically.
[self.matrix setToolTip:#"Tooltip for first item" forCell:[self.matrix cellAtRow:0 column:0]];
[self.matrix setToolTip:#"Tooltip for second item" forCell:[self.matrix cellAtRow:1 column:0]];
Careful, if in InterfaceBuilder you click the button, you can add the tooltip to the button, and the class displayed under "Custom Class", top right, is NSButton. But, if you click the button again, as you do while selecting stuff in xcode, what is selected is the NSButtonCell, which appears to have a separate tooltip. If you're not careful you add your tooltip to the NSButtonCell instead of the NSButton, and it won't show in your running application.
So, the problem may be that you have clicked the button one more time in IB, and you thought to enter the tooltip for the NSButton, but you didn't.
Personally I think it may be a bug, why would you want to add a tooltip for the button cell?

Popover not attached to anchor

I'd like to show a popover with it's arrow to a button that is part of my view (e.g. button is on my main view). I do this in Interface Builder storyboard editor (ctrl drag from button to popup contents view). Popup shows but not attached to the button. What I found for the buttons on the toolbar popover shows attached to the button as expected. Anchor property of the segue is set to this button. Xcode Version 7.0.1 (7A1001).
Edit: images of what I do:
1) Storyboard. First I ctrl drag from toolbar button to first controller, then ctrl drag to second controller from second button.
2) Correctly attached popover
3) Popover not attaches to in-view button.
You are right. Following method shows that the sending view is nil and by default contentview of window is used for popover.
So to fix just check if the positioningView is nil. if yes, set it to be button (create outlet for it).
Add following method to your viewController
- (void)presentViewController:(NSViewController *)viewController asPopoverRelativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView preferredEdge:(NSRectEdge)preferredEdge behavior:(NSPopoverBehavior)behavior
{
//do custom implementation (workaround)
[super presentViewController:viewController asPopoverRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge behavior:behavior];
}

Link a button on a site to specific view

I have created two views in my main storyboard ->
Now I added a button on the first one which should link to the other one (so when I press it it should lead to the other view). I have id't the one I want to link to with SceneViewController.
I copied the following code (and defined the method in the header) ->
- (IBAction)button:(id)sender {
SceneViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:#"SceneViewController"];
[self.navigationController pushViewController:controller animated:YES];
}
But nothing happens when I press the button. Anybody a clue on what I'm doing wrong?
Thanks, cheers!
It's not enough to just copy the IBAction code. You have to link the button in the storyboard to the IBAction method you created in your header file.
Open your storyboard, click on the Assistant Editor icon at top right of screen (little icon of a waistcoat and bow tie). Make sure the right pane has your header file selected, if not you can chane to it in the drop down at the top.
Then zoom in on your button, right click on it and drag to the IBAction line in your header file. This should create the connection for you.

Mac Application bottom bar add button

I added a bottom bar on NSWindow in IB by select "Content Border-Large Bottom Border". And I add a custom Image button on the bottom bar, but when I press the button, the background of the button turns into white, why?
This is the effect when press down the button:
Change button's type to Momentary Change. You can change it in Attributes inspector:
Or change programatically:
[button setButtonType:NSMomentaryChangeButton];

Popup UIPicker when tapping on UITextField

I need to display/show a Picker when a user taps on a textfield, I mean, it should appear a picker instead of a keyboard. Also, some sort of "done" button above the picker so the user clicks on it and the value from the picker is copied to the textfield and the picker is hidden again.
I've checked many tutorials from the web but haven't found anyone that can really help me.
I found a tutorial that pointed me in the right direction but I'm still missing to disappear the keyboard when clicking on the textfield.
Dismissing UIPickerView with Done button on UIToolBar by #slev
Any ideas?
If you're not targeting iOS versions older than 3.2, it's easy. You can either assign the UIPickerView as the inputView property of the UITextField and the UIToolbar containing the 'done' button as the inputAccessoryView, or you could make a single UIView that has both the picker and the toolbar as subviews and assign that as the intputView (and leave inputAccessoryView as nil). Either way, this will animate your picker in in place of the normal keyboard when the text field is activated.
More details on this are available in the documentation.

Resources