Let me start out by saying you don’t actually ever #include/#import the xib,
(that’s the user interface file and even when you’ve chosen to use the
interface builder you don’t ever include it anywhere) I can tell you that stack
overflow is a wonderful resource for any objective c/cocoa help. (personally i
find the apple documentation horribly lacking)
alright so if i were you just to start learning and understand what’s going on
i’d add your button to your appDelegate (NSObject class automatically added to
every project)
You’ll want to use either your
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification OR your
-(void)awakeFromNib method to go ahead and draw your UIButton i’ll include a
snippet in the email that uses awakeFromNib, should do what you’re looking
for...
-(void)awakeFromNib
{
UIButton *myButton = [[UIButton alloc]
initWithFrame:NSMakeRect(0,0,50,50)];
// this draws a square button (50 by 50 pixels) in the bottom left
corner
[myButton addTarget:self action:@selector(buttonPressed)
forControlEvents:UIControlEventTouchUpInside];
// this tells the button to use the buttonPressed method when the
control event happens... i.e.: the user presses the button
}
-(void)buttonPressed
{
//Put whatever you want the button to do in here, right now it just
logs the fact the button was pressed in your debug output
NSLog (@“SEE THE USER PRESSED THE BUTTON”)
}
The above code should work just fine although i wrote it in the email without
testing, let me know if there’s any other way i can help :)
On Jul 5, 2013, at 2:09 AM, Yuma Antoine Decaux <[email protected]> wrote:
> Do you have a link where i can see where i'm supposed to programmatically
> link controls?
>
> I know there are statements to include in controller.h controller.m and
> application.xib, but im not sure what i'm supposed to write in
> application.xib
>
> Any help greatly appreciated. I've given up on emulating interface
> manipulation with voice over, its the most time wasting thing i've done so
> far.
>
>
>
>
> "Light has no value without darkness"
>
>
>
> On 5/07/2013, at 2:12 PM, Tyler Thompson <[email protected]> wrote:
>
>> believe me i understand the frustrations of working with objective C,
>> especially if it’s new. As it happens I find that programmatically linking
>> your UI elements tends to actually work a little better (as it gives you
>> much more control), but for each person it’s different :)
>>
>>
>> On Jul 5, 2013, at 1:05 AM, Yuma Antoine Decaux <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> There is a method which i found on the maccessibility news page.
>>> Convoluted, and not able to do it yet, it's driving me crazy.
>>>
>>> I might try it programmatically but i'm going through a textbook method and
>>> they're entirely gui based so i'm left wanting, once more. Starting to get
>>> tired of the whole idea of computers.
>>>
>>> Feel like throwing this macbook out and hammer it
>>>
>>>
>>>
>>>
>>> "Light has no value without darkness"
>>>
>>>
>>>
>>> On 5/07/2013, at 12:28 PM, Tyler Thompson <[email protected]> wrote:
>>>
>>>> To tack on to my previous comment here’s how you can programatically link
>>>> objects with objective c
>>>>
>>>> NSButton *theButton;
>>>> [theButton addTarget:self action:@selector(buttonMethod:)
>>>> forControlEvents:someControlEvent];
>>>>
>>>>
>>>> On Jul 4, 2013, at 10:23 PM, Yuma Antoine Decaux <[email protected]> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am going through an IOS book right now, and am stuck at a point where i
>>>>> need to create an action in my controller for a button. I'm supposed to
>>>>> control drag a button to my assistant editor so that x code can
>>>>> automatically place the appropriate action method and properties to my
>>>>> project.h, project.m and project.xib files. But there is no control drag
>>>>> in voice over.
>>>>>
>>>>> Is this another unsurmountable obstacle or is there actually a method to
>>>>> do this?
>>>>>
>>>>> Any help greatly appreciated
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Yuma
>>>>>
>>>>>
>>>>>
>>>>> "Light has no value without darkness"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Light has no value without darkness"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups
>>>>> "MacVisionaries" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>>> email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "MacVisionaries" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "MacVisionaries" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/macvisionaries.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "MacVisionaries" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/macvisionaries.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/macvisionaries.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/groups/opt_out.