python yt-dl.py "http://www.yt.com/watch?v=<id_goes_here>" --format 18 --best-quality
Replace “yt” for you favorite video provider…
python yt-dl.py "http://www.yt.com/watch?v=<id_goes_here>" --format 18 --best-quality
Replace “yt” for you favorite video provider…
How to create a “Settings” right bar button (only text).
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStylePlain target:self action:NULL];
self.navigationItem.rightBarButtonItem = item;
[item release];
“action” has not been set in the example.
For more details see the “Using Custom Buttons and Views as Navigation Items” section of the “View Controller Programming Guide for iPhone OS”.
How do you identify a textfield if several can be received at “- (BOOL)textFieldShouldReturn:(UITextField *)textField”?
I don’t know how good it is but I did the following (I used the placeholder that the textfields have):
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if ([[textField placeholder] isEqualToString:@”Title”]) {
[textField resignFirstResponder];
[notesTextField becomeFirstResponder];
}
else if ([[textField placeholder] isEqualToString:@”Notes”]) {
[textField resignFirstResponder];
}
return YES;
}
The easiest way is to start with the appropriate template:
That will generate the app delegate and a RootViewController. The RootViewController includes a table but it can be removed and replaced by a view. Then the superclass has to be changed to UIViewController, and the File’s owner “view” outlet needs to be connected to the view.
Check that everything works.
RootViewController’s view will be the main screen of the application. In order to be accurate add a “Navigation Bar” as “Top Bar” in the “Simulated Interface Elements” of the view attributes.
Now we will generate another view and we will navigate to it.
To generate another view go to File -> New File -> Cocoa Touch Class -> UIViewController subclass. Make sure that you select “With XIB for user interface” and “Also create XxxViewController.h”.
To be able to navigate to that new view we can add a toolbar in the RootViewController’s view with a bar button. You can change the bar button identifier to “Add” to get a “+” symbol on it. Then you need to declare an action:
And implement it:
You will need to import the “XxxViewController.h”. Also, link the action (“newItem”) with the bar button in Interface Builder.
The action will create the view controller for the second view and it will be pushed to the navigation controller. In order to get an automatic button to get back to the root view controller, the root view controller needs to have a title. Include in its “- (void)viewDidLoad” the following:
You should be able now to use the button to go to the new view controller and the back button (“Items”) to go back to the root view controller.
How to:
If your test says that the output folder has been deleted because it is empty:
Quick reminder on how to hide keyboard when the user hits the “return” key.
You just need to set the view controller as the delegate of the text field (it has to conform the UiTextFieldProtocol). Then call the resignFirstResponder method of the text field in the “(BOOL)textFieldShouldReturn:(UITextField *)textField” call.
Check this for a more detailed explanation and implementation code.
Call 537 and select option 4.
I’m still starting with iPhone development and I was stuck with two very basic things, errors that will crash the application with no clue in the console:
To see the routing table:
To add a new route:
It happened to me in Leopard and Snow Leopard.
Trying to use Mercurial (hg) from the terminal I got an error complaining about UTF-8.
The solution is to include something like the following two lines in .profile (“es_ES” part corresponds to my locale, use yours):
export LC_ALL=es_ES.UTF-8
export LANG=es_ES.UTF-8