New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

OS X and IOS development


Post Reply New Thread Subscribe

 
Thread Tools
Yodda_Hunter

 
Member Since: Jun 08, 2013
Location: Būr said,Egypt
Posts: 158
Yodda_Hunter is on a distinguished road
Mac Specs: MacBook Pro (i5)

Yodda_Hunter is offline
Guys. why there is diffrance between OS X codes and IOS codes,i know both are woking with the same programming language but some code aren't the same,like this example
--------------------------------------------------------
OS X:
if (textfield.stringvalue=@"Hey") {
(Lable.stringvalue = @"Hello");

----------------------------------------------------------
IOS:
if ([textfield.text isEqual:@"Hey]) {
(label.text = @"Hey");
-----------------------------------------------
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 167
Mark FX has a spectacular aura about

Mark FX is offline
The reason is that NSTextfield and UITextField have different methods, the NSTextfield class was designed years before the UITextField class, so when they started creating the iOS Cocoa Touch frameworks, they changed some of the ways and methods for the UI versions of the NS classes.

The NSTextField does not have a "text" property, and inherits it's "stringValue" property from the NSControl parent class.

And the UITextField does not have a "stringValue" property, nor does the UIControl class from which it inherits.

You can use the "isEqual" or "isEqualTo" on both NS and UI variants, as they both inherit these methods from the NSObject master class.

Regards Mark
QUOTE Thanks
Yodda_Hunter

 
Member Since: Jun 08, 2013
Location: Būr said,Egypt
Posts: 158
Yodda_Hunter is on a distinguished road
Mac Specs: MacBook Pro (i5)

Yodda_Hunter is offline
thanks . well,what does NSLog do? tried a lot to get the answer but didn't understand the meaning.
at least give me a code and tell me what a result i'll gain at the last
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 167
Mark FX has a spectacular aura about

Mark FX is offline
I dont really understand you're question, putting NSLog statements in you're code prints the results to the debug console window at the bottom of the Xcode IDE, like the example below.

Code:
NSLog(@"Print this string to the debug console");
//OR
NSLog(@"myTextField stringValue = %@", myTextField.stringValue);
//OR
NSLog(@"My Integer variables value = %d", myIntegerVariable);
Does that answer you're question, I'm not sure.

As for you're original question, the differences are not to do with the Objective-C language, but are to do with the differences between the Cocoa and Cocoa Touch Frameworks and their different classes.

Regards Mark
QUOTE Thanks
Yodda_Hunter

 
Member Since: Jun 08, 2013
Location: Būr said,Egypt
Posts: 158
Yodda_Hunter is on a distinguished road
Mac Specs: MacBook Pro (i5)

Yodda_Hunter is offline
Quote:
Originally Posted by Mark FX View Post
I dont really understand you're question, putting NSLog statements in you're code prints the results to the debug console window at the bottom of the Xcode IDE, like the example below.

Code:
NSLog(@"Print this string to the debug console");
//OR
NSLog(@"myTextField stringValue = %@", myTextField.stringValue);
//OR
NSLog(@"My Integer variables value = %d", myIntegerVariable);
Does that answer you're question, I'm not sure.

As for you're original question, the differences are not to do with the Objective-C language, but are to do with the differences between the Cocoa and Cocoa Touch Frameworks and their different classes.

Regards Mark
What i can get from your words that the NSLog isn't a code that gives the User any use,It's only useful for The programmer him self. Well,thanks too,i though it was showing Message for the user but fine thanks but i actually i can ask you how to show a message } shall i use try/catch? And if so,what is the code?
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 167
Mark FX has a spectacular aura about

Mark FX is offline
Yes you're correct, the NSLog() statement is for you the programmer to help you debug you're code.

Using @try/@catch/@finally blocks are a bit old fashioned these days, and are more associated with C and Java, but you can use them in objective-C as well, although most Objective-C programmers use the NSError and NSException classes, but error handling is a big subject and you should read some of Apple's documentation pages to learn more.

https://developer.apple.com/library/...011210-CH9-SW1

Also if you want to show the User a warning message you should use NSAlert message boxes, and Apple also provides detailed documentation on this subject as well.

https://developer.apple.com/library/...uid/TP40004001

https://developer.apple.com/library/...00871-BAJBFGED

Hope this helps

Regards Mark
QUOTE Thanks

Post Reply New Thread Subscribe


« Building Android on a MBP (need help with an error) | NSlog C99 error. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Rumor: iOS 7 to see significant overhaul, development running behind schedule OneMoreThing... Apple Rumors and Reports 29 04-17-2013 11:10 PM
iOS app development Nola26 iOS and Apps 1 06-15-2012 04:59 AM
What's a good Mac for iOS development? johnhoffman Apple Notebooks 1 02-15-2012 10:18 PM
PSA: This is why non-developers shouldn't run iOS betas OneMoreThing... Apple Rumors and Reports 0 08-16-2011 09:13 AM

All times are GMT -4. The time now is 03:00 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?