I need a way of capturing a view or the screen with everything just exactly like it appears on screen. -renderInContext: won't do that. Are there any alternatives to this?
I have made an class which conforms to the NSCoding protocol and does all the encode and decode stuff.
For my app, I simply want to persist an object from that class to the device and the next time when the app launches, I want to load that object back into memory.
Basically it's just an class which holds some user input information. For example the user starts writing a text but then quits the app. Next time I want to load that data object.
I guess I need NSKeyedArchiver? Is there a good tutorial on this? How do I do that?
I need to know which cell is touched when any button inside the cell is touched. I have custom UIButton *button1 in the cell and UIButton *button2 on the cell.imageView.image of the cell. I wrote selectors for both buttons.; But, I could not differentiate the buttons for each cell. How do I know which cell button was touched. What to do, to know that a particular cell's button was touched ?
Thank you.
I am always subclassing UITableViewCell's and drawing them in code. Is there a good tool to visually get rect sizes so I don't have to guess and check all the time?
I'm probably just being a bit lazy here, but bear with me. Here's my situation. I have a class with two nonatomic, retained properties. Let's say:
@property (nonatomic, retain) UITextField *dateField;
@property (nonatomic, retain) NSDate *date;
I synthesize them as expected in the implementation. What I want to happen is that whenever the setter on date is invoked, it also does something to the dateField (i.e. it sets the text property on the dateField to be a nicely formatted version of the date).
I realize I can just manually override the setter for date in my implementation by doing the following:
- (void) setDate:(NSDate *)newDate {
if (date != newDate) {
[date release];
date = [newDate retain];
// my code to touch the dateField goes here
}
}
What would be awesome is if I could let Objective C handle the retain/release cycle, but still be able to "register" (for lack of a better term) a custom handler that would be invoked after the retain/release/set happens. My guess is that isn't possible. My google-fu didn't come up with any answer to this, though, so I thought I'd ask.
I have searched quite a bit(sample one, Sample two) but cant seem to get the correct answer.
I have a webview on my XYZ view controller class. When i press on a button, it takes an URL from an array and re-loads the same webview. Now I need to do the flip book animation on it. Same webview should be reloaded. That is the webview should rotate around its own axis 180/360 degree while the loading of next url is going on. Is this possible?
Hi,
I'm having a problem with properties of the following type:
id<ProtocolName> variableName;
.....
.....
@property (nonatomic, retain) id<ProtocolName> variableName;
I can access and use them just fine, but when I try to call
[variableName release];
I get compiler warnings:
'-release' not found in protocol(s)
Do I need to define a release method in the interface, or how do I release the memory reserved for the variable?
Thanks!
When playing music from the users iPod library via the [MPMusicPlayerController applicationMusicPlayer], is there a way to access the channel information much in the same way that you can with the AVAudioPlayer. The goal is to create a level meters while the song is playing.
I have a button on a view, I want to add another button next to it when the first button is touched.
Therefore I need it's top left corner to do the math.
Here's what is puzzling me greatly:
// this code is executed when the button is pressed
NSLog(@"X:%f",moreButton.frame.origin.x);
that returns on the first and second click the followings:
2010-04-24 22:58:25.883 iPad PopOver[8095:40b] X:-1.999002
2010-04-24 22:58:25.884 iPad PopOver[8095:40b] Y:0.000000
why and how can I get the x,y of an existing button on the view? (button created via IB)
Thanks!
mE
ps: I have looked at similar posts and my code looks fine but I keep getting zeros (it's an ipad app if matters in any way)
I have been lead to believe that it is possible to pass a class as a method parameter, but I'm having trouble implementing the concept. Right now I have something like:
- (id)navControllerFromView:(Class *)viewControllerClass
title:(NSString *)title
imageName:(NSString *)imageName
{
viewControllerClass *viewController = [[viewControllerClass alloc] init];
UINavigationController *thisNavController =
[[UINavigationController alloc] initWithRootViewController: viewController];
thisNavController.tabBarItem = [[UITabBarItem alloc]
initWithTitle: title
image: [UIImage imageNamed: imageName]
tag: 3];
return thisNavController;
}
and I call it like this:
rootNavController = [ self navControllerFromView:RootViewController
title:@"Contact"
imageName:@"my_info.png"
];
What's wrong with this picture?
I'd like to do some timezone calculation, using the following API:
NSTimeZone *some_time_zone = [NSTimeZone timeZoneWithAbbreviation:name];
however, I am not sure where to find the supported list of abbreviation names. For example, what is the name for the timezone of Siena Italy?
-(void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific);
CGContextSetTextPosition(context,80,80);
CGContextShowText(context, "hello", 6);
//not even this works
CGContextShowTextAtPoint(context, 1,1, "hello", 6);
}
I want to kn ow how to call above method, i have paste above code in the implemntation file simply, but dont know why its not called when i execute the project, can some one
When I set a Launch Image, Xcode creates a copy as Default.png and creates an entry in my plist in Icon Files (IOS 5) / Primary Icon / Icon Items -- Item 1 : Default.png
Item 0 : MyIcon.png is the app icon which I have already placed through the Target.
The reason this is a problem is that the launch image then takes precedence over the actual icon and as a result, it shows as the primary icon instead of my actual icon image.
Why is Xcode doing this?
Can I safely delete the Default.png entry from my .plist? (this seems to fix the problem)
Do I need to copy Default.png somewhere else?
Thanks!
Let say here is my stack layout
View3 --> Top of the stack
View2
View1
HomeView --> Bottom of the stack
So I am in View3 now, if I click the Home button, I want to load HomeView, meaning that I need to pop View3, View2, and View1. But if I pop View3, View2 will be displayed. I dont want that. I want View3, View2, and View1 be removed, and HomeView will be displayed. Any idea how?
I want to attach a video and send email from my application.
I downloaded apples example code MailComposer. I compiled it. I did not get any errors or warnings.
I sent the mail to my mail id. But, I could not see any mail in my inbox. I am working on simulator.
I did not set any senders email id in simulator.
How can I know whether the code is working or not ?
Thank You.
How can I do this? I want the cells appear like just a collection of items with no separations in the form of lines?
And also how can I make the contentView of a cell go transparent?
I'm trying to mimic a pager with my app by sending push notifications to the user until he or she responds. My thought was to send a push every few seconds and play the default sound on arrival. Not perfect, but better than nothing.
It's working all right. However, I am finding that the sound starts to stutter/interrupt a bit after a few notifications have been sent -- as if it's trying to play the sound more than once. This happens even if I only send the push every 10 seconds. I just tested it at 20 second intervals and even then it starts to sound interrupted after about 10 times.
Any idea how to resolve this so each message plays the sound crisply?
p.s. Testing performed on an iPad.
I have a ViewController that takes time to load its views. When I run Instruments, I see from the home screen, if I tap on the icon that pushes that view controller onto the stack, it's half laying out the views, and half getting the data for the views. I tried adding an activity indicator to display on the home screen over the button when the button is pressed to push the LongRunningViewController onto the stack. So I basically do this:
- (IBAction)puzzleView:(id)sender {
dispatch_async(dispatch_get_main_queue(), ^{
[self.activityIndicator startAnimating];
});
PuzzleViewController *detailViewController = [[[PuzzleViewController alloc] init] autorelease];
[self.navigationController pushViewController:detailViewController animated:YES];
[self.activityIndicator stopAnimating];
}
I have a table view controller which doesn't let me manually scroll to the last row. It automatically scrolls slightly up so I could never select the last 2-3 rows. Anyone experienced this problem? Should I set a minimum height for the table view to solve this? If so how?
I have several iOS apps that all use the same port to listen for a network beacon. On the main view I use viewWillDisappear to close the port when another view is opened, which was working great. Then I noticed if I pressed the home button from the main view controller without opening another view to close the port, then the port stays open and non of my other apps can listen on that port any more. I then tried using viewWillUnload, but that doesn't seem to get called when I press the home button.
-(void)viewWillUnload
{
//[super viewWillUnload];
NSLog(@"View will unload");
[udpSocket close];
udpSocket = nil;
}
View will unload is never displayed in the console, which leads me to believe that the method is never getting called.
Is there a way to detect when the home button is pressed so I can close my port?