Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Controls & Widgets

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Nov 12, 2008 9:20 pm    Post subject: Controls & Widgets Reply with quote

MF - Programmatically creating GUI's in Cocoa?

"Take a look at the GNUStep tutorials. They do a pretty good job at basic
interface building through the API."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Jan 04, 2009 4:07 am    Post subject: Reply with quote

SO - Adding Date Picker to view programatically?

"Try the UIControls example provided in the iPhone SDK sample code. That
shows you how to add almost any control programatically."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Apr 05, 2009 5:02 am    Post subject: Reply with quote

Apple Discussions - flaky hit detection, especially of the info button

"Has anyone experienced flaky hit detection of the info button in their ap-
plications using the "main view/flip side view" template."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Mon Apr 06, 2009 3:16 pm    Post subject: Reply with quote

Just show me how to do it! - iPhone SDK Examples

"This site is meant for the relatively new iPhone Developer who just wants
simple examples to common tasks."


Anothere take at the "Info button" case:
"Increase the touchable area on the Info button, so it's easier to press."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Mon May 18, 2009 2:16 pm    Post subject: Reply with quote

chris-software - Creating a nice glass buttons

"There is a simple way to achieve results similar to the Stopwatch application.
All you have to do is to get rid of UIButton and use UISegmentedControl."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue May 26, 2009 12:06 am    Post subject: Reply with quote

iphonedevsdk.com - What does "Auto-enable Return Key" mean in IB?

"For a UITextField, what does "Auto-enable Return Key" mean in the
Interface Builder's "Text trait's" section for configuring the text field?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat May 30, 2009 4:45 pm    Post subject: Reply with quote

iPhone Development Blog - How To Create A Data Entry Screen

"One of the more tedious things in iPhone development is to create functi-
onal data entry screens. The challenge is to fit the necessary text fields on
the screen and deal with the keyboard that pops up and covers roughly h-
alf the screen. There is surprisingly little support for this in the SDK."


Code:
- (NSArray *)entryFields { 
    if (!entryFields) { 
        self.entryFields = [[NSMutableArray alloc] init]; 
        NSInteger tag = 1; 
        UIView *aView; 
        while (aView = [self.view viewWithTag:tag]) { 
            if (aView && [[aView class] isSubclassOfClass:[UIResponder class]]) { 
                [entryFields addObject:aView]; 
            } 
            tag++; 
        } 
    } 
    return entryFields; 
}
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat May 30, 2009 6:28 pm    Post subject: Reply with quote

osmorphis - A General Purpose Table Form Editor

"The TableFormEditor class is intended to be used within a UINavigation-
Controller. In other words, you allocate a TableFormEditor instance, configu-
re it, then push it on top of the navigation stack.

The TableFormEditor will create a grouped table and the first section will con-
tain rows with UITextField objects to display and allow editing of data. These
rows can optionally contain labels that identify what each row represents, or
you can have no labels..."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Sep 30, 2009 5:57 pm    Post subject: Reply with quote

SO - iPhone Style Buttons

"Is there a standard/accepted way of making image buttons the “iPhone”
style? i.e. with the gloss highlight and rounded corners."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Mar 29, 2010 1:30 am    Post subject: Reply with quote

Jeff LaMarche - Irregularly Shaped UIButtons

"You probably know that UIButton allows you to select an image or back-
ground image with alpha, and it will respect the alpha."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed May 19, 2010 12:44 am    Post subject: Reply with quote

Jeff LaMarche - Programmatic Gradient Buttons

"All you have to do is override three methods to specify the gradient to use
when the button is in its normal state, the gradient to use when the button
is in highlighted (pressed) state, and the corner radius. Here's what the al-
ert-style button looks like now..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun May 23, 2010 9:16 pm    Post subject: Reply with quote

Jeff LaMarche - Gradient Buttons Yet Again

"I added two more button styles to the iPhone Gradient Buttons project and
made stroke color and stroke weight configurable options. The two new
styles look exactly like the old Black and White style, only the highlight state
is a blue gradient."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Tue Jun 08, 2010 4:30 pm    Post subject: Reply with quote

MF - iPhone 4 - Retina Screen Implications

"In some of our apps some buttons are pre-rendered (including the
text) and some are native... so I'm thinking - This will look a bit odd
on the iPhone 4".
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Aug 05, 2010 2:13 am    Post subject: Reply with quote

iphonedevsdk.com - UITextView scrollRangeToVisible broken in OS3?

"It appears that scrollRangeToVisible doesn't like a length of 0 even though
the documentation says you can."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Oct 11, 2010 10:25 am    Post subject: Reply with quote

so - iPhone SDK: Creating a big, red UIButton

"Using the iPhone SDK, how would I go about creating a red "delete" button
similar to the one used when deleting contacts on the iPhone? Anyone have
a green one?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Nov 11, 2010 5:25 pm    Post subject: Reply with quote

MF - Custom Button Image Sizes?

"What is the image size needed to add a custom image to a round rect button
for Mac? Are there default back, forward, and refresh buttons similar to what
iOS has?
...
Go here, then scroll down..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Mar 08, 2011 9:52 pm    Post subject: Reply with quote

so - How to correctly subclass UIControl?

"The key is to listen for both the sender and the event so that you can find
out more information about the actual event (such as the location of where
the event occurred)."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Oct 02, 2013 8:51 am    Post subject: Reply with quote

MF - iOS 7 button with border (Apple uses it)

"Is it possible to create a button in iOS 7 with a border the way that Apple
did in iTunes Radio?"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Oct 16, 2013 3:30 pm    Post subject: Reply with quote

infragistics.com - Using CAShapeLayer to Create a Switch

"CALayers are extremely powerful for rendering primitives and geometry,
then animating out changes to the geometry or visual properties such as
color. In this blog post we'll expand on the flat indicator view post that uses
a CAShapeLayer to create a switch similar to UISwitch found in iOS 7."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Dec 21, 2018 12:22 pm    Post subject: Reply with quote

github - Re-Engineering UISwitch

"You often see non-native control elements in these designs. Some, such as
checkboxes, have no native counterpart in UIKit while others like switches are,
except they're nearly impossible to customize. You cannot even change the size
of a UISwitch. What if you need to implement a completely custom designed
switch for your app. Where would you start?"


https://medium.com/@nathantannar4/re-engineering-uiswitch-9a82f270edfd
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Mar 10, 2019 1:17 pm    Post subject: Reply with quote

https://instabug.com/blog/creating-ui-elements-programmatically-using-purelayout/

Creating UI Elements Programmatically Using PureLayout

Welcome to part two of Creating UIViews Programmatically Using PureLayout. In the first part, we built a simple mobile application's UI completely in code without the use of Storyboards or NIBs. In this tutorial, we will cover some of the most used UI elements in all applications:

UINavigationController/Bar
UITableView

Self-sizing UITableViewCell
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Nov 01, 2019 2:52 pm    Post subject: Reply with quote

How to implement a down arrow / caret (like in the iOS 9 Music app) in an iOS Swift project?

Code:
let workout = NSMutableAttributedString(string: "Workout", attributes: [NSFontAttributeName: UIFont(name: "Verdana", size: 14)!])
let arrow = NSMutableAttributedString(string: "\u{2304}", attributes: [NSFontAttributeName: UIFont(name: "Verdana", size: 37)!])

let combination = NSMutableAttributedString()
combination.append(workout)
combination.append(arrow)

sender.setAttributedTitle(combination, for: .normal)
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Nov 01, 2019 3:26 pm    Post subject: Reply with quote

so - How to set the title of UIButton as left alignment?

emailBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Dec 26, 2021 6:47 pm    Post subject: Reply with quote

so - Programmatically create and position an NSButton in a macOS app?

Code:
NSButton *myButton = [[[NSButton alloc] initWithFrame:NSMakeRect(x, y, width, height)] autorelease];
    ...


All buttons are controls and all controls are views, so see, in order:

The View Programming Guide
The Control and Cell Programming Topics
The Button Programming Topics
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Dec 26, 2021 7:04 pm    Post subject: Reply with quote

Kuba Suder's blog - A guide to NSButton styles

"The list below describes the button styles in the same order as in the Xcode
panel, and for each button it includes: the Xcode name, the constant name,
screenshots of how it looks on Yosemite (on the left) and on Mavericks (on the
right), and some guidelines I found about how it's supposed to be used, or how
it's actually used by Apple in their apps."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Jul 26, 2023 10:33 am    Post subject: Reply with quote

so - Text change notification for an NSTextField

"I would like to use the code ... to observe the value of an NSTextField on
an NSTextField in order to observe changes on the string stored in the
NSTextField."


https://github.com/NSGod/MDControlTextDidChange

https://github.com/NSGod?language=objective-c&page=2&q=&sort=&tab=repositories
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Jul 30, 2023 7:17 pm    Post subject: Reply with quote

so - How to determine whether an NSSearchField/NSTextField has input focus?

"AppKit uses a 'field editor' (which is an NSTextView) to handle the actual
editing in an NSTextField (or an NSSearchField or an NSSecureTextField).
While your text field has keyboard focus for its window, it has the field editor
as a subview, and the window's first responder is the field editor.

So in general, you can check whether the text field has a field editor:"


Code:
if textField.currentEditor() != nil {
    // textField has the keyboard focus
} else {
    // textField does not have the keyboard focus
}
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Jul 30, 2023 7:49 pm    Post subject: Reply with quote

so - Focus a NSTextField

a) [yourTextField becomeFirstResponder];

b) [[self window] makeFirstResponder:[self yourTextField]];
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Mon Aug 21, 2023 4:53 pm    Post subject: Reply with quote

so - Cocoa: How to make multiline NSTextField?

"There is no way to specify this behavior solely in Interface Builder. You can
do it with a delegate message as described in this tech note QA1454."


Code:
if (commandSelector == @selector(insertNewline:))  {
   // new line action:
   // always insert a line-break character and don't cause the receiver to end editing
   [textView insertNewlineIgnoringFieldEditor:self];
   result = YES;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group