Hi,
I am using static images in Imageview to show some area. I want to place pin markers that we can create on google maps.
What is a good way to implement this?
Thanks in advance.
Lets say I have an array X that contains [A,B,C,D,nil];
and I have a second array Y that contains [E,F,G,H,I,J,nil];
If I execute the following:
//Append y to x
[x addObjectsFromArray:y];
//Empty y and copy x
[y removeAllObjects];
y = [x mutableCopy];
What is the value of y? is it?:
[A,B,C,D,E,F,G,H,I,J,nil]
Am I performing the copy correctly?
I've noticed that I'm getting very intermittent orientation on my device & the simulator.
I have a modal view controller that I present, and that is the only thing in my app which supports rotation.
If I launch the app in portrait without moving the device, open the modal VC and then rotate the device, it usually works. However sometimes if I open the app holding the device in landscape, then rotate to portrait, launch the VC and then rotate the device, no rotation occurs. It seems very intermittent. Sometimes if I launch the app in portrait mode and then open the VC and rotate the device, nothing happens, and until I quit and relaunch it no orientation occurs in the app.
It's strange because 50% of the time it works! Whenever I launch it through Xcode and set breakpoints in shouldAutorotateToInterfaceOrientation it always works!
Anyone ever had this or know what's going on?
I've got a simple question but it has got me confounded. The code below gets an UNDEFINED error for UIControlTouchUpInside. What do I need to include or import? If I comment out the line, it works. So that means forState:UIControlStateNormal is defined. I'm new so hope you can help.
UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Accept?" forState:UIControlStateNormal];
[button addTarget:self action:@selector(acceptTapped) forControlEvents:UIControlTouchUpInside];
Is there a way for the developer of an App Store application to tie a sale to an individual user/device ID/Apple account? In other words, a method for the developer to double-check that a specific user has legally purchased the software?
I haven't been able to find a reliable answer to this yet. I'm not looking for specific code examples, just some sort of idea as to how possible (or difficult) this is.
My intent isn't to penalize piracy; it's to be able to provide additional benefits to paid customers. As such, I'm not looking for a way to identify a cracked or pirated version, which I gather has already been solved.
Thanks in advance for any help you can provide!
HI all,
i hv an alert view for twitter posting.
Alert view has 2 button and a textfeild
send and cancel
i want to disable send button,until user fills the message box(i.e textfeild).
like,empty field kind of validation.
so,how can i disable send button??
regards
shishir
Hi,
I keep getting a crash when loading a UITableView. I am trying to use a cell defined in a nib file.
I have an IBOutlet defined in the view controller header file:
UITableViewCell *jobCell;
@property (nonatomic, assign) IBOutlet UITableViewCell *jobCell;
This is synthesised in the implementation file.
I have a UITableViewCell created in IB and set it's identifier to JobCell.
Here is the cellForRowAtIndexPath method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"JobCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"JobsRootViewController" owner:self options:nil];
cell = jobCell;
self.jobCell = nil;
}
// Get this job
Job *job = [fetchedResultsController objectAtIndexPath:indexPath];
// Job title
UILabel *jobTitle;
jobTitle = (UILabel *)[cell viewWithTag:tagJobTitle];
jobTitle.text = job.title;
// Job due date
UILabel *dueDate;
dueDate = (UILabel *)[cell viewWithTag:tagJobDueDate];
dueDate.text = [self.dateFormatter stringFromDate:job.dueDate];
// Notes icon
UIImageView *notesImageView;
notesImageView = (UIImageView *)[cell viewWithTag:tagNotesImageView];
if ([job.notes length] > 0) {
// This job has a note attached to it - show the notes icon
notesImageView.hidden = NO;
}
else {
// Hide the notes icon
notesImageView.hidden = YES;
}
// Job completed button
// Return the cell
return cell;
}
When I run the app - I get a hard crash and the console reports the following:
objc[1291]: FREED(id): message style sent to freed object=0x4046400
I have hooked up all the outlets in IB correctly. What is the issue?
Thanks,
In an iPad app, I'm using a custom subclass of UIView with UIViewController. Here's the view header:
@interface pdfView : UIView {
CGPDFDocumentRef doc;
}
-(void)setDoc:(CGPDFDocumentRef)newDoc;
@end
And here's the controller header:
@interface iPadPDFTestViewController : UIViewController {
CGPDFDocumentRef doc;
}
- (void)loadPDF;
@end
Part of the controller implementation:
- (void)viewDidLoad {
[super viewDidLoad];
[self loadPDF];
[self.view setDoc:doc];
}
In Interface Builder, I've set the view object to use the class pdfView.
At compilation, [self.view setDoc:doc]; gives the warning "'UIView' may not respond to '--setDoc'." I'm guessing that this warning appears because the compiler thinks it's looking at UIView (which does not implement the setDoc method) instead of pdfView. But why does it think that? And how can I tell it what class it's really looking at, so as to clear the warning?
Hi. I am trying to show detailed UItable view when clicking on row. I used
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
photoListViewController = [[PhotoListViewController alloc]initWithNibName:@"PhotoListViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:photoListViewController animated:YES];
[photoListViewController release];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
}
This PhotoListViewController is an empty UITableViewController. As I know UITableViewCOntroller has a navigation controller implemented and I don`t have to create navigation controller. But When I clicked on row it does not navigate to second view.AM I have to make some connection on nib file?I only created this PhotoListViewController in File-New-UIViewCOntroller and selected UITableView.
EDIT : SOLVED
I solved my problem.I should use UINAvigation object.I thought that UITable has it but there was no ))
How would I smooth a line (UIBeizerPath) or a set of points? Right now it draws it jagged. I read about spline interpolation, could anyone point me to an implementation of this in cocoa or C or give me an alternate line smoothing algorithm.
I have a map annotation view that contains a rightcallout button which loads an accessory view which is a UIViewController class. I am using resuable annotations, but am wondering how I can pass updated information to my UIViewController class. Let's say I have 2 string values which map to 2 UILabels on my view. How can I update those values after the initial accessory view has already been loaded into memory as a resusable view?
Any help would be appreciated.
I use a lot of UINavigationControllers in my app. I am using a UIColor to set the tintcolor of the navigationBar. This works as expected, but I am trying to find an easy way to set a default tintcolor for all UINavigationControllers. What is the best way to do this? Is it subclassing the UINavigationController, or is there something better?
Thanks for the help.
Hello,
I am trying to create an image cropping bpx whereby the underlying image can be zoomed an scrolled while the cropping "maskview" layer stays the same and the corners can be dragged in any direction.
To achieve this, the ImageView is added to a UIScrollView, and this is added to the SelectionViewController.view . I then add the cropping "maskview" layer to the SelectionViewController.view. I did this instead of adding to the scrollview so that the cropping maskview won't be expanded when the underlying image expands.
@interface SelectionViewController : UIViewController <UIScrollViewDelegate>
{
UIImageView *photoview; // Added to self.scrollview
MaskedView *maskedview; // Added to self.view
UIScrollView *scrollview; // Added to self.view
}
The maskview has first responder status and responds accordingly. However, the only event I am interested in the maskview is if any of the corners are dragged (this works fine). The problem I want to try to solve is two-fold:
If it is a pinch or zoom gesture, I am trying to forward the responder to the UIScrollview using:
[self.nextResponder touchesMoved:touches withEvent:event];
The scrollview does not seem to respond. I have confirmed that the self.nextResponder after the maskedview is the SelectionViewController's view itself. From there, it doesn't seem like the UIScrollview responds. It does respond fine if I remove the cropping maskedview.
If I zoom in on the underlying image and the cropping maskview rectangle is still the same, I want to now crop the actual zoomed image. Let's say for the upper left hand corner of the crop box, how can I find what the coordinates translates to in the underlying UIImageView now that the image has been zoomed?
Any insight into either of these questions would be appreciated.
Thank you,
Winston
I am re-using Apple's AdvancedTableViewCells example to create a custom, fast-scrolling tableview. Specifically, I am using their CompositeSubviewBasedApplicationCell method which draws the content on the tableviewcell with drawRect
Everything works, but how do you hide a label or set the tag for a label or image using their method? Doing it this way is pretty new to me (without IB), so I apologize ahead of time if it's something easy.
The code that sets the cell content is:
- (void)drawRect:(CGRect)rect
{
[_cell.animalIcon drawAtPoint:CGPointMake(5.0, 5.0)];
[_cell.animalName drawAtPoint:CGPointMake(93.0, 25.0)];
_highlighted ? [[UIColor whiteColor] set] : [[UIColor colorWithWhite:0.23 alpha:1.0] set];
[_cell.animalDescription drawAtPoint:CGPointMake(100.0, 54.0) withFont:[UIFont boldSystemFontOfSize:13.0]];
[_cell.animalNameString drawAtPoint:CGPointMake(93.0, 5.0) withFont:[UIFont boldSystemFontOfSize:13.0]];
}
I am using a header view, not section header, with my UITableView. The documentation says that the header view sits on top of the table, but my header view scrolls just like a normal row. Is there a way to make the header view always visible at the top of the table?
An UIPicker shows up when I select a row in a table, so I can choose some things I want to be displayed on the same row.
How can I update the table once I finished with the uipicker? I used reloadData right after the call to the picker, but the code is executed before I do "Done" on the picker.
Some idea?
Thank u
My app has several buttons which trigger different events. The user should NOT be able to hold down several buttons. Anyhow, holding down several buttons crashes the app.
And so, I'm trying to disable multi-touch in my app.
I've unchecked 'Multiple Touch' in all the xib files, and as far as I can work out, the properties 'multipleTouchEnabled' and 'exclusiveTouch' control whether the view uses multitouch. So in my applicationDidFinishLaunching I've put this:
self.mainViewController.view.multipleTouchEnabled=NO;
self.mainViewController.view.exclusiveTouch =YES;
And in each of my view controllers I've put this in the viewDidLoad
self.view.multipleTouchEnabled=NO;
self.view.exclusiveTouch=YES;
However, it still accepts multiple touches. I could do something like disable other buttons after getting a touch down event, but this would be an ugly hack. Surely there is a way to properly disable multi-touch?
I have a tabBar with 4 tabs on it, and I want to perform some action when a specific tab is selected, so I have uncommented the UITabBarControllerDelegate in the xxAppDelegate.m
I also wanted to see the value that was being sent logged in the console - in order to test my "if" statement. However this is where I got stumped.
// Optional UITabBarControllerDelegate method
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
NSLog(@"%@", viewController);
}
The console dutifully logged any selected controller that had been selected, but in this particular format:
<MyViewController: 0x3b12950>
Now, I wasn't expecting the square brackets or the colon or the Hex. So my question is how do I format my IF statement? This is what I thought would work but I get an error mentioned further down.
// Optional UITabBarControllerDelegate method
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
NSLog(@"%@", viewController);
if (viewController == MyViewController)
{
//do something nice here …
};
}
... The error is "Expected expression before 'MyViewController'"
Anyone know how I should be doing this?
Does anyone have an example of how to handle read and write NSStream events in Monotouch when working with accessories via EASession?
It looks like there isn't a strongly typed delegate for this and I'm having trouble figuring out what selectors I need to handle on the delegates of my InputStream and OutputStream and what I actually need to do with each selector in order to properly fill and empty the buffers belonging to the EASession object.
Basically, I'm trying to port Apple's EADemo app to Monotouch right now.
Here's the Objective-C source that I think is relevant to this problem:
/
/ asynchronous NSStream handleEvent method
- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
{
switch (eventCode) {
case NSStreamEventNone:
break;
case NSStreamEventOpenCompleted:
break;
case NSStreamEventHasBytesAvailable:
[self _readData];
break;
case NSStreamEventHasSpaceAvailable:
[self _writeData];
break;
case NSStreamEventErrorOccurred:
break;
case NSStreamEventEndEncountered:
break;
default:
break;
}
}
/ low level write method - write data to the accessory while there is space available and data to write
- (void)_writeData {
while (([[_session outputStream] hasSpaceAvailable]) && ([_writeData length] > 0))
{
NSInteger bytesWritten = [[_session outputStream] write:[_writeData bytes] maxLength:[_writeData length]];
if (bytesWritten == -1)
{
NSLog(@"write error");
break;
}
else if (bytesWritten > 0)
{
[_writeData replaceBytesInRange:NSMakeRange(0, bytesWritten) withBytes:NULL length:0];
}
}
}
// low level read method - read data while there is data and space available in the input buffer
- (void)_readData {
#define EAD_INPUT_BUFFER_SIZE 128
uint8_t buf[EAD_INPUT_BUFFER_SIZE];
while ([[_session inputStream] hasBytesAvailable])
{
NSInteger bytesRead = [[_session inputStream] read:buf maxLength:EAD_INPUT_BUFFER_SIZE];
if (_readData == nil) {
_readData = [[NSMutableData alloc] init];
}
[_readData appendBytes:(void *)buf length:bytesRead];
//NSLog(@"read %d bytes from input stream", bytesRead);
}
[[NSNotificationCenter defaultCenter] postNotificationName:EADSessionDataReceivedNotification object:self userInfo:nil];
}
I'd also appreciate any architectural recommendations on how to best implement this in monotouch. For example, in the Objective C implementation these functions are not contained in any class--but in Monotouch would it make sense to make them members of my
there is a .png image displaying human body skeleton.My query is that how to select diffrent parts of the skeleton like hand,foot,head etc in the image and then after selection control moves into another view which displays information about that selected part.
I'm using quartz to display pdf content, and I need to create a table of contents to navigate through the pdf. From reading Apple's documentation I think I am supposed to use CGPDFDocumentGetCatalog, but I can't find any examples on how to use this anywhere. Any ideas?
I have a regular text field on a view and I'd like to make use of the search button on the iPhones keyboard. For the life of me, I can't figure out how to do this. There doesn't seem to be any event exposed that I can wire up that specifically relates to the search button on the keyboard. I've googled around, but I also haven't found anything related to this subject.
I want to create 2 separate layers using quartz 2D. Can i handle there redraw methods separately? so that i can redraw 1 layer without redrawing the whole screen or other layers.
Is it possible? any code sample?