This is Part 3 of 3 for my NSXML Parser Tutorial. Part 1 – www.youtube.com Part 2 – www.youtube.com
Source : iphonedevx[dot]com
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
This is Part 3 of 3 for my NSXML Parser Tutorial. Part 1 – www.youtube.com Part 2 – www.youtube.com
Introducción a la Programación en iOS
Image by Nearsoft
@ Summer Talks 2011
Important things to know before you start development, Honestly this should be the first lesson before starting development iphone development tutorial “Macworld” “expo” “steve” “jobs” “iphone” “ipod” “apple” “touchscreen” “keynote” “nano” “video” “iphone” “sdk” “development” “tutorial” “app” “store” “beginner” “getting” “started” “hello” “world” “xcode” “iphone” “sdk” “development” “programming” “objective-c” “iphone development tutorial” “app” “store” “beginner” “getting” “started” “hello” “world” “iphone” “dev” “tutorial”
Objective-C® for Dummies® by Neal Goldstein, Copyright © 2009 by Wiley Publishing, Inc., is the main source of information for this video. In this lesson we go into Xcode and try out what we learned in Part 1. Twitter – twitter.com FaceBook – www.facebook.com E-mail – macandcomputerhelp@gmail.com Objective-C Tutorial objective-c tutorial objective c tutorial
Video Rating: 4 / 5
In this application we will see how to hide button from the iPhone application. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using Single View Application. Give the application
“ButtonHide”.
Step 2: Need to add new viewController class in the project. Select project -> New file ->
UIViewController subclass -> next -> Give the application name “ButtonHideView”.
Step 3: Now open the AppDelegate.h file and make the following changes:
@class ButtonHideView;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
ButtonHideView *buttonHideView;
}
@property (nonatomic, retain)IBOutlet ButtonHideView *buttonHideView;
@property (strong, nonatomic) UIWindow *window;
@end
Step 4: In the AppDelegate.m file make the following changes:
@implementation AppDelegate
@synthesize window = _window,buttonHideView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
buttonHideView = [[ButtonHideView alloc]
initWithNibName:@"ButtonHideView"
bundle:nil];
[_window addSubview:buttonHideView.view];
return YES;
}
@end
Step 5: Now open the “ButtonHideView.h” file and make the following changes:
@interface ButtonHideView : UIViewController
{
IBOutlet UIButton *button1;
IBOutlet UITextField *textfield1;
}
@property (nonatomic, retain) IBOutlet UIButton *button1;
@property (nonatomic, retain) IBOutlet UITextField *textfield1;
-(IBAction) ButtonHide:(id)sender;
//}
@end
Step 6: Double click the ButtonHideView.xib file and open it to the Interface Builder. First drag the
UIButton and UITextField from the library and place it to the view window. Select the button from
the view window and bring up connection inspector and connect touch up inside to the File’s Owner
icon and select “ButtonHide:” method and connect the File’s owner icon to the textfield and select
“textfield1”. Now save the .xib file, close it and go back to the Xcode.
Step 7: In the ButtonHideView.m file make the following changes:
@implementation ButtonHideView
@synthesize button1,textfield1;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(IBAction) ButtonHide:(id)sender
{
if([textfield1.text isEqualToString: @""]){
button1.hidden = YES;
} else {
button1.hidden = NO;
}
NSLog( @"%@", textfield1.text );
}
@end
Step 8: Now Compile and run the application on the Simulator
Question by Teeter: What are some magazines that are in print for development and programming?
I need one that actually mails out, not online. Can be about:
* Website development
* Website programming
* Website design
* Database programming
* Linux or linux server administration
* Open source software
* Mac programming or iPhone programming (there are probably not very many of these)
* Specific languages: Java, Javascript, HTML
Best answer:
Answer by Victor
I used to subscribe to Linux magazine. Good insight on upcoming items and code snippets on hot topics. Good read. Recommended.
see:
http://www.linux-mag.com/contact
Give your answer to this question below!
Description: Objective-C video tutorials — In these programming video series I’ll go through the basics of objective-c object oriented programming language. Objective-c is the programming language of Apple Mac OSX Operating system and the language of iOS. So if you want to develop applications for Mac, iPhone, iPad, and iPod touch then you have to master objective-c programming language. It’s one of the best programming language and it’s easy to learn. It is derived from the C language but it’s Object-oriented which makes it better. These video tutorials are for beginners and gradually we’ll discuss the advanced part of objective-c as time goes on. If you have any questions drop a comment. And don’t forget to rate and like all the videos to allow others to benefit from these objective-c video tutorials.
Every since updated my iPhone 5 and iPad 3 to iOS 6.1.2, Siri will not launch any apps except Apple own. After every other request, Siri replieswith the response, "I don't see an app named".
How to use the NSMutableArray class in Objective-C.
Video Rating: 5 / 5
THE #1 BESTSELLING BOOK ON OBJECTIVE-C 2.0
Programming in Objective-C 2.0 provides the new programmer a complete, step-by-step introduction to Objective-C, the primary language used to develop applications for the iPhone, iPad, and Mac OS X platforms. The book does not assume previous experience with either C or object-oriented programming languages, and it includes many detailed, practical examples of how to put Objective-C to use in your everyday iPhone/iPad or Mac OS X progr
List Price: $ 44.99
Price:
Description: Objective-C video tutorials — In these programming video series I’ll go through the basics of objective-c object oriented programming language. Objective-c is the programming language of Apple Mac OSX Operating system and the language of iOS. So if you want to develop applications for Mac, iPhone, iPad, and iPod touch then you have to master objective-c programming language. It’s one of the best programming language and it’s easy to learn. It is derived from the C language but it’s Object-oriented which makes it better. These video tutorials are for beginners and gradually we’ll discuss the advanced part of objective-c as time goes on. If you have any questions drop a comment. And don’t forget to rate and like all the videos to allow others to benefit from these objective-c video tutorials.
Question by Advice Please: If you want to add data to an iphone script. What type of file do you do this with?
Also, can you submit an iphone programmed with a windows pc? I know it has to be coded on a mac, but if someone codes it and emails you the files, can they be forwarded onto apple this way? Can the windows person fill out a data file or does that have to also be done on a mac? Say I had a list of soups I wanted to have listed on the application. Can the windows pc create that list or does it have to be a mac file?
Best answer:
Answer by Rodrigo33024
You can import data to your iphone app by creating a plist or a sqlite file, they both can be created on a PC or mac, they are just text files with the information that you will be importing.
Once you have the plist or sqlite files you need to import them to xcode in the resources folder and your iphone application will need to be programmed to open the file, read its content and display it.
You will also need to recompile your app after that.
Know better? Leave your own answer in the comments!
The UINavigationController maintains a UIToolBar for each view controller in its stack. This toolbar is normally hidden, but we can place buttons on it and display it any time we want. Let’s see how this is done.
Start Xcode, select “Create a new Xcode project” and select the Empty Application template. Click Next, name the project ToolBarButtons, and choose options as shown:
Click Next, choose a location to save the project, and finally click Create. When the project has loaded, select the AppDelegate.m file, right-click that file, and select “New File” from the popup menu. (The reason we selected the AppDelegate.m file first is that Xcode will place newly created files immediately below the selected file in the navigator.)
Select the Objective-C class template, click Next, and name the class MainViewController. Make sure that the class is a subclass of UIViewController, and also create a XIB file for the controller’s view as shown:
Click Next, accept the default location, and click Create.
Now we’re going to set up a navigation controller having a MainViewController object as its root view controller. Select the AppDelegate.h file, and add the two properties for the UINavigationController and the MainViewController as shown:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *navController;
@property (strong, nonatomic) MainViewController *rootViewController;
@end
Make sure that the MainViewController file is imported, otherwise we won’t be able to instantiate on object from it.
After adding the navController and rootViewController objects, Open the AppDelegate.m file, and make the following changes:
@implementation AppDelegate
@synthesize window = _window;
@synthesize navController = _navController;
@synthesize rootViewController = _rootViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.rootViewController = [[MainViewController alloc] initWithNibName:nil bundle:nil];
self.rootViewController.title = @"Main View";
self.navController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
[self.window addSubview:self.navController.view];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
…
As always, we first synthesize our properties. We’ve only shown the application: didFinishLaunchingWithOptions: method here, because it’s the only method we will be making changes to. Leave the remaining methods in place.
First, we allocate and initialize the rootViewController. The nib name of nil in this case directs the compiler to associate this controller with the XIB file that was created with it (MainViewController.xib). A bundle of nil directs the compiler to use this application’s bundle. After we initialize this controller, we set its title to @”Main View.” This title will appear in the navigation bar for this view controller.
Next, we set up the navController object. We make rootViewController this object’s Root View Controller. Adding the navController’s view to the main window as a subview, we then make the main window key and visible, and we’re off and running.
In the MainViewController.xib file, choose a nice color for the view:
Since the view controller’s title property was set to @”Main View” in the AppDelegate, that title will appear at the top of the interface when we run the app:
Open the MainViewController.m file, and make these additions to initWithNibName: bundle:
First, we add a UIBarButtonSystemItemSearch button to the navigationItem’s rightBarButtonItems array. This button will be placed at the right of the top navigation bar. Next, we set up three bar buttons (btnRed, btnBlue, and btnGreen) and a spacer. The three buttons each have a selector, these will be defined shortly. Each also is initialized with a title, and a style of UIBarButtonItemStyleDone, which will produce a button with a blue background and white bolded text.
The function of the spacer is to add “flexible space” between btnBlue and btnGreen. Flexible space will act as a “spring” between the two buttons, pushing btnGreen all the way to the right of the tool bar. Since this space is invisible, it makes no sense to assign it an action method, so we have set both the target and action of this object to nil.
Now that we have the buttons, we need to add them to the tool bar. Each view controller has it’s own toolBarItems property, which is an NSArray of UIBarButtonItem objects. This line:
stuffs the toolBarButtons array with the three buttons and the spacer.
All that remains now is to implement the four methods we set as actions in the buttons:
- (void)btnRedTouched
{
self.view.backgroundColor = [UIColor redColor];
}
- (void)btnBlueTouched
{
self.view.backgroundColor = [UIColor cyanColor];
}
- (void)btnGreenTouched
{
self.view.backgroundColor = [UIColor greenColor];
}
toggleToolBar gets the hidden property of the tool bar, then sets that property to its negation. In other words, if the tool bar is hidden it will be shown, if it is shown it will be hidden.
The three btn…Touched methods set the color of the view’s background to red, cyan, or green when they are touched.
Run the app, and enjoy:
Review:
“Most of the books I scanned, even the ‘Dummies’ series, assumed a basic knowledge of computer programming even for iOS beginners. What I like about Kevin’s writing is that he doesn’t make any assumptions — he just takes you there — step by step.” – Lorraine Akemann – Moms With Apps
Unleash the App Developer Within!
This first book in the series from Kevin McNeish, award-winning App Developer, highly acclaimed iOS trainer and conference speaker, is specifically desi
List Price: $ 16.99
Price:
LightingPad is the perfect tool for controlling small shows, or for installing and testing lighting systems. It’s also great for programming our LightCue Pro lighting controller. Simply connect any Art-Net compatible DMX device to your wireless network, and you have a complete lighting console in the palm of your hand. Because it’s an iPad / iPhone application, it’s incredibly simple to use. For more information, visit www.alcorn.com
Editor’s note: Some of you asked us to write a tutorial about audio recording. This week, we work with Raymond Au from Purple Development to give you an introduction of AVFoundation framework. Raymond is an independent iOS developer and has recently released Voice Memo Wifi that allows users to record voice memo and share it over WiFi.
iOS provides various framework to let you work with sound in your app. One of the frameworks that you can use to play and record audio file is the AV Foundation Framework. In this tutorial, I’ll walk you through the basics of the framework and show you how to manage audio playback, as well as, recording.
To provide you with a working example, I’ll build a simple audio app that allows users to record and play audio. Our primary focus is to demonstrate the AV Foundation framework so the user interface of the app is very simple.
The AV Foundation provides easy ways to deal with audio. In this tutorial, we mainly deal with these two classes:
First of all, create a “Single View Application” and name it as “AudioDemo”. To free you from setting up the user interface and code skeleton, you can download the project template from here.
I’ve created a simple UI for you that it only contains three buttons including “Record”, “Stop” and “Play”. The buttons are also linked up with the code.
AudioDemo Project Template
By default, the AVFoundation framework is not bundled in any Xcode project. So you have to add it manually. In the Project Navigator, select the “AudioDemo” project. In the Content Area, select “AudioDemo” under Targets and click “Build Phases”. Expand “Link Binary with Libraries” and click the “+” button to add the “AVFoundation.framework”.
Adding AVFoundation Framework
To use the AVAudioPlayer and AVAudioRecorder class, we need to import
| 1 | #import <AVFoundation/AVFoundation.h> |
First, let’s take a look how we can use AVAudioRecorder to record audio. Add the AVAudioRecorderDelegate protocol and AVAudioPlayerDelegate in the ViewController.h. We’ll explain both delegates as we walk through the code.
| 1 | @interface ViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate> |
Next, declare the instance variables for AVAudioRecorder and AVAudioPlayer in ViewController.m:
| 1 2 3 4 | @interface ViewController ( ) { AVAudioRecorder *recorder; AVAudioPlayer *player; } |
The AVAudioRecorder class provides an easy way to record sound in iOS. To use the recorder, you have to prepare a few things:
We’ll do the setup in the “viewDidLoad” method of ViewController.m. Simply edit the method with the following code:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - ( void )viewDidLoad { [super viewDidLoad ]; // Disable Stop/Play button when application launches [stopButton setEnabled : NO ]; [playButton setEnabled : NO ]; // Set the audio file NSArray *pathComponents = [ NSArray arrayWithObjects : [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES ) lastObject ], @ "MyAudioMemo.m4a", nil ]; NSURL *outputFileURL = [ NSURL fileURLWithPathComponents :pathComponents ]; // Setup audio session AVAudioSession *session = [AVAudioSession sharedInstance ]; [session setCategory :AVAudioSessionCategoryPlayAndRecord error : nil ]; // Define the recorder setting NSMutableDictionary *recordSetting = [ [ NSMutableDictionary alloc ] init ]; [recordSetting setValue : [ NSNumber numberWithInt :kAudioFormatMPEG4AAC ] forKey :AVFormatIDKey ]; [recordSetting setValue : [ NSNumber numberWithFloat : 44100.0 ] forKey :AVSampleRateKey ]; [recordSetting setValue : [ NSNumber numberWithInt : 2 ] forKey :AVNumberOfChannelsKey ]; // Initiate and prepare the recorder recorder = [ [AVAudioRecorder alloc ] initWithURL :outputFileURL settings :recordSetting error : NULL ]; recorder.delegate = self; recorder.meteringEnabled = YES; [recorder prepareToRecord ]; } |
Note: For demo purpose, we skip the error handling. In real app, don’t forget to include proper error handling.
In the above code, we first define the sound file URL for saving the recording. and then configure the audio session. iOS handles audio behaviour of an app by using audio sessions. Upon launch, your app automatically gets an audio session. You can grab such session by calling [AVAudioSession sharedInstance] and configure it. Here, we tell iOS that the app uses “AVAudioSessionCategoryPlayAndRecord” category which enables both audio input and output. We will not go into the details of audio session but you can check out the official document for further details.
The AVAudioRecorder uses a dictionary-based settings for its configuration. In line 21-25, we use the options keys to configure the audio data format, sample rate and number of channels. Lastly, we initiate the audio recorder by calling “prepareToRecord:” method.
Note: For other settings keys, you can refer to AV Foundation Audio Settings Constants.
We’ve completed the audio preparation. Let’s move on to implement the action method of Record button. Before we dive into the code, let me explain how the “Record” button works. When user taps the “Record” button, the app will start recording and the button text will be changed to “Pause”. If user taps the “Pause” button, the app will pause the audio recording till the “Record” is tapped again. The audio recording will only be stopped when user taps the “Stop” button.
Edit the “recordPauseTapped:” method with the following code:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - (IBAction )recordPauseTapped : ( id )sender { // Stop the audio player before recording if (player.playing ) { [player stop ]; } if ( !recorder.recording ) { AVAudioSession *session = [AVAudioSession sharedInstance ]; [session setActive : YES error : nil ]; // Start recording [recorder record ]; [recordPauseButton setTitle : @ "Pause" forState :UIControlStateNormal ]; } else { // Pause recording [recorder pause ]; [recordPauseButton setTitle : @ "Record" forState :UIControlStateNormal ]; } [stopButton setEnabled : YES ]; [playButton setEnabled : NO ]; } |
In the above code, we first check whether the audio player is playing. If audio player is playing, we simply stop it by using the “stop:” method. Line 7 of the above code determines if the app is in recording mode. If it’s not in recording mode, the app activates the audio sessions and starts the recording. For recording to work (or sound to play), your audio session must be active.
In general, you can use the following methods of AVAudioRecorder class to control the recording:
For the Stop button, we simply call up the “stop:” method to the recorder, followed by deactivating the audio session. Edit the “stopTapped:” method with the following code:
| 1 2 3 4 5 6 | - (IBAction )stopTapped : ( id )sender { [recorder stop ]; AVAudioSession *audioSession = [AVAudioSession sharedInstance ]; [audioSession setActive : NO error : nil ]; } |
You can make use of AVAudioRecorderDelegate protocol to handle audio interruptions (say, a phone call during audio recording) and the completion of recording. In the example, the ViewController is the delegate. The methods defined in AVAudioRecorderDelegate protocol are optional. Here, we’ll only implement the “audioRecorderDidFinishRecording:” method to handle the completion of recording. Add the following code to ViewController.m:
| 1 2 3 4 5 6 | - ( void ) audioRecorderDidFinishRecording : (AVAudioRecorder * )avrecorder successfully : ( BOOL )flag { [recordPauseButton setTitle : @ "Record" forState :UIControlStateNormal ]; [stopButton setEnabled : NO ]; [playButton setEnabled : YES ]; } |
After finishing the recording, we simply change the “Pause” button back to “Record” button.
Finally, it comes to the implementation of the “Play” button for audio playback using AVAudioPlayer. In the ViewController.m, edit the “playTapped:” method using the following code:
| 1 2 3 4 5 6 7 | - (IBAction )playTapped : ( id )sender { if ( !recorder.recording ) { player = [ [AVAudioPlayer alloc ] initWithContentsOfURL :recorder.url error : nil ]; [player setDelegate :self ]; [player play ]; } } |
The above code is very straightforward. Normally, there are a few things to configure an audio player:
The delegate of an AVAudioPlayer object must adopt the AVAudioPlayerDelegate protocol. In this case, it’s the ViewController. The delegate allows you to handle interruptions, audio decoding errors and update the user interface when an audio has finished playing. All methods in AVAudioplayerDelegate protocol are optional, however. To demonstrate how it works, we’ll implement the “audioPlayerDidFinishPlaying:” method to display an alert prompt after the completion of audio playback. For usage of other methods, you can refer to the official documentation of AUAudioPlayerDelegate protocol.
Add the following code in ViewController.m:
| 1 2 3 4 5 6 7 8 | - ( void ) audioPlayerDidFinishPlaying : (AVAudioPlayer * )player successfully : ( BOOL )flag { UIAlertView *alert = [ [UIAlertView alloc ] initWithTitle : @ "Done" message : @ "Finish playing the recording!" delegate : nil cancelButtonTitle : @ "OK" otherButtonTitles : nil ]; [alert show ]; } |
You can test audio recording and playback using a physical device or software simulator. If you test the app using actual device (e.g. iPhone), the audio being recorded comes from the device connected by the built-in microphone or headset microphone. On the other hand, if you test the app by using the Simulator, the audio comes from the system’s default audio input device as set in the System Preference.
So go ahead to compile and run the app! Tap “Record” button to start recording. Say something, tap the “Stop” button and then select the “Play” button to listen the playback.
AudioDemo App
For your reference, you can download the complete source code from here. Feel free to leave me comment if you have any questions.
This post is contributed by Raymond Au from Purple Development. Raymond is an independent iOS developer and has recently released Voice Memo Wifi that allows users to record voice memo and share it over WiFi.