I want to read alias in Mac OS X programatically. When I tried it always read original file.
Any idea how it can be done?
thanks for your all suggestions.
Hi,
I'm fairly new to the world of bindings in cocoa, and I'm having some troubles (perhaps/probably due to a misunderstanding).
I have a singleton that contains an NSMutableArray called plugins, containing objects of class Plugin. It has a method called loadPlugins which adds objects to the plugins array. This may be called at any point. It's been added as an instance in Interface Builder.
Also in IB is an NSObjectController, whose content outlet is connected to the singleton. There is also an NSArrayController, whose contentArray is bound to the NSObjectController (controller key is 'selection', model key path is 'plugins', object class name is 'Plugin').
And finally I have a table view with 2 columns, the values of which are bound to the NSArrayController's arrangedObjects, using keys of properties in the Plugin class.
So far so standard (as far as I can tell from tutorials at least). My trouble is that when the loadPlugins method is called in the singleton, and objects are added to the plugins array, the table doesn't update to show the objects (unless loadPlugins is called before the nib is loaded). -reloadData called on the tableView doesn't do anything.
Is there a way to tell the NSArrayController that the referenced array has been updated? I understand there is the -add: method for NSArrayController, which could be used in the loadPlugins, but this isn't desirable as I want to keep the singleton totally separate from the display aspect.
This seems related to:
http://stackoverflow.com/questions/1623396/refresh-cocoa-binding-nsarraycontroller-combobox
The line: "editing the array behind the controller's back" seems to perhaps pinpoint the problem, but I would hope that it would be possible to have the singleton not know about the controller.
Thanks in advance.
Hello,
I'm still rather new to iPhone development and I tried something I didn't it was possible. I have a UIView for my TableView Section Header with a switch on it, and I also have a UITableCellView with another Switch on it. It all looks fine, but now I want to propagate the UISwitch state from the section header to all the UISwitches on the section rows. Can anyone enlighten me how can I accomplish this?
Thank you.
What is the difference between "UIAccelerometer" and "CLLocationManager"? Both give me x, y and z axis as result.
UIAccelerometer
X -18.000
Y -03.500
Z -41.000
CLLocationManager
X -0.036
Y -0.002
Z -1.069
Is this information from the same sensors with different formatting? Or are there "real" differences?
Thanks!
I need to do data detection of website URL's in live chat and display them in a UILabel NOT UITextView. They need to be clickable and will open a in-app browser. We have tried Craig Hockenberry's code, three20, and making our own, all of which didn't work. We need to use UILabel to take advantage of shadows. Anyone know what to do? Help!
I'm pretty sure I've run across this animation at some point, but I can't remember where or how to do it!
I want the equivalent of UIViewAnimationTransitionCurlDown but a full page horizontal curl. Does anybody have code that does this?
Thanks!
Hi there,
I've played a little bit with OpenAL, and I must say that it's pretty fast, even on the iPhone.
However, I still got one problem.
My app is recording the user voice, and repeats what he said using OpenAL.
I've modified the AL_PITCH value, but it's currently also changing the speed, which I don't want to !
Is there a simple way to only change the tonality ?
Thanks ;)
I get the directory path from fsevent, such as "/User/Data/"
But what I really want is "/User/Data/change.txt"
I have read the programming guide, it said
typedef void ( *FSEventStreamCallback )(
ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[]);
eventPaths An array of paths to the
directories in which event(s)
occurred.
is there any method to find out which file is altered?
thanks!!!!
I have stuck to it for so long..
Hello i have received this message ever since i started building my first iphone program several months ago. I check if a delegate implements a given method. It works but I get this warning. How can i do it the correct way? Thanks in advance.
Since upgrading to the latest XCode 3.2.1 and SnowLeopard, I've been getting the warning,
"format not a string literal and no
format arguments"
on the following:
NSError *error = nil;
if (![self.managedObjectContext save:&error])
{
NSLog([NSString stringWithFormat:@"%@ %@, %@",
errorMsgFormat,
error,
[error userInfo]]);
}
If 'errorMsgFormat' is an NSString with format specifiers (eg: "print me like this: %@"), what is wrong with the above NSLog statement? And what is the recommended way to fix it so that the warning isn't generated?
In here said that using MBProgressHUD is easy.
But i cant make it.
Here my code:
- (IBAction)save{
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
[HUD show:YES];
NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"];
SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title];
[savePage save];
[HUD hide:YES];
}
the progress indicator not show during [savePage save] method run, but show after the page completely saved (the indicator show for less than 1 second).
I also tried this way:
- (IBAction)save {
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Saving...";
[HUD showWhileExecuting:@selector(performFetchOnMainThread) onTarget:self withObject:nil animated:YES];
}
- (void) savingPage{
NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"];
SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title];
[savePage save];
}
-(void) performFetchOnMainThread {
[self performSelectorOnMainThread:@selector(savingPage) withObject:nil waitUntilDone:YES];
}
but still no luck. Anyone let me know where im lack here??
P.S [savePage save] is saving all website contents to local directory. I wish once the saving is complete the progressHUD disappear.
Thanks
I need to catch two different swipping gestures using UISwipeGestureRecognizer(for example, UISwipeGestureRecognizerDirectionRight and UISwipeGestureRecognizerDirectionLeft). When I add two different recognisers with addGestureRecognizer method, only last added recognizer works. I've read that I need to implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: method of UIGestureRecognizerDelegate protocol, but nothing works.
Can anyone help with simple example of catching two or more same gestures?
Thanks!
Hi: I want to display a section index in an UITableView with a search bar in the table view header (not section header).
But the index strip is now overlapping the search bar. Is there an elegant solution to avoid this and let the index start below the table header?
Hello! I'm developing a simple tab bar application for school.
It has 3 tabs.
One of them plays music in streaming and I would like to stop the music playing when the user changes the tab. Is this possible? and How? Thank you in advance!
Hi there! Im using a UIWebView to access a website, when i rotate the phone (landscape) the UIWebView is properly resized and the scrollbar are on the right place (on the right edge...) but when i acess any of input fields to fill the information required and exit it the UIWebView scrollbar jumps to the middle of screen (looks like it get back to 320, the width of the screen on portrait). Some useful info, this program was created using IB, have lots of outlets, im thinking about in do (redo) everything programmatically cause i was not the author of the first version... If anyone have seen this before plz let me know..
Thanks in advance!
I know soft shadows are not supported by the UILabel our of the box, on the iPhone. So what would be the best way to implement my own one?
EDIT: Obviously I will subclass the UILabel and draw in the -drawRect:
My question is, how do I get the contents of the label as graphics and draw around them, blur them etc...
I'm trying to use the MPMediaPlayback protocol's currentPlaybackRate() to slow down a video. I'm confused though as the class MPMoviePlayerController states that:
You can control most aspects of playback programmatically using the methods and properties of the MPMediaPlayback protocol, to which this class conforms.
Except just above in the header here: http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html it doesn't seem to.
All I want to do is slow down the playback rate for a video.
Is there an easy way to do this that works in 10.5?
In 10.6 I can use nsImage CGImageForProposedRect: NULL context: NULL hints: NULL
If I'm not using 1b black and white images (Like Group 4 TIFF), I can use bitmaps, but cgbitmaps seem to not like that setup... Is there a general way of doing this?
I need to do this because I have an IKImageView that seems to only want to add CGImages, but all I've got are NSImages. Currently, I'm using a private setImage:(NSImage*) method that I'd REALLY REALLY rather not be using...
For the method
[NSThread detachNewThreadSelector:@selector(method:) toTarget:self withObject:(id)SELECTOR];
How do I pass in a @selector? I tried casting it to (id) to make it compile but it crashes in runtime.
More specifically, I have a method like this
+(void)method1:(SEL)selector{
[NSThread detachNewThreadSelector:@selector(method2:) toTarget:self withObject:selector];
}
it crashes, how do I pass in the selector without crashing? So that the new thread can call the selector when the thread is ready?
I'm using the following for a LIKE query. Is this technique for LIKE correct?
selectstmtSearch = nil;
if(selectstmtSearch == nil){
const char *sql = "SELECT col1, col2 FROM table1 t1 JOIN table2 t2 ON t1.cityid = t2.cityid where t1.cityname like ?001 order by t1.cityname";
if(sqlite3_prepare_v2(databaseSearch, sql, -1, &selectstmtSearch, NULL) == SQLITE_OK)
{
sqlite3_bind_text(selectstmtSearch, 1, [[NSString stringWithFormat:@"%%%@%%", searchText] UTF8String], -1, SQLITE_TRANSIENT);
}
}
The problem I'm having is after a few uses of this, I get an error 14 on sqlite3_open(), which is unable to open database. If I replace the LIKE with something such as:
SELECT col1, col2
FROM table1 t1
JOIN table2 t2 ON t1.cityid = t2.cityid
where t1.cityname = ?
order by t1.cityname
It works fine. I do open/close the DB before after the above code. Is there a way to troubleshoot exactly why the database can't be opened and what its relationship to my LIKE syntax is?
Hi,
I have a UILabel tha contains a URL (ie www.google.com). Is there a way to display the label as URL so the User can tap on the URL for Safari to open it?
Same question I have for a mailto item (ie [email protected]) to open mail with a new email to that address
thanks in advance
I'm doing a bunch of core data inserts and after 20k or so inserts with saves every 1-2k I get this error:
Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSCFSet: 0x1b0b30> was mutated while being enumerated.'
I'm trying to figure out which NSSet is causing this. I've done a search and the only NSSets in my code are the autogenerated ones that handle the Core Data relationships.
I'm using NSXMLParser and for each element found creating a new entity (if a matching one doesn't already exist).
So I will create a state entity and then populate all the city entities and then do a save. This means that a state's NSSet *cities is getting added to but I don't see why you can't do that.