Search Results

Search found 19072 results on 763 pages for 'iphone sdk 4'.

Page 42/763 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • iPhone NSCalendar - Incorrect Calendar Drawn for users outside US

    - by xoail
    After trying to work on someone else's code, and so many different iterations, I am unable to understand what am I doing wrong with dates on a calendar month view. I am trying to present a calendar in month view fashion like calendar.app but unfortunately some users in countries like Australia, UK are reporting incorrect alignment of Days to Dates. For instance in Australia it displays 17th March as Friday. Any help is highly appreciated! Here is the code sample I am using: -(void)setCalendar { NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *comps = [gregorian components:units fromDate:[NSDate date]]; self.currentDate = [gregorian dateFromComponents:comps]; NSInteger weekdayInteger=[comps weekday]; currentMonth=[comps month]; currentYear=[comps year]; NSString *dateString=[[NSString stringWithFormat:@"%@",currentDate] substringToIndex:10]; NSArray *array= [dateString componentsSeparatedByString:@"-"]; NSInteger currentDay=[[array objectAtIndex:2] intValue]; currentMonthConstant=currentMonth; currentYearConstant=currentYear; currentDayConstant=currentDay; currentConstantDate=[NSString stringWithFormat:@"%d/%d/%d",currentDayConstant,currentMonthConstant,currentYearConstant]; currentFirstDay=((8+weekdayInteger-(currentDay%7))%7); if(currentFirstDay==0) currentFirstDay=7; [gregorian release]; } And this is how im populating the calendar: -(void)fillCalender:(NSInteger)month weekStarts:(NSInteger)weekday year:(NSInteger)year { currentMonth=month; currentYear=year; currentFirstDay=weekday; UIButton *temp; NSInteger numberOfDays=[self getNumberofDays:month YearVlue:year]; currentLastDay=(currentFirstDay+numberOfDays-1)%7; if(currentLastDay==0) currentLastDay=7; NSString *monthName=[self getMonth:month]; NSInteger grid=(weekday-1); monthLabel.text=[NSString stringWithFormat:@"%@ %d",monthName,year]; for(int i=1;i<=numberOfDays;i++) { if([frontView isEqualToString:@"view1"]) temp=[arr_View2Buttons objectAtIndex:grid]; else temp= [arr_View1Buttons objectAtIndex:grid]; [temp setBackgroundImage:nil forState:UIControlStateNormal]; [temp setUserInteractionEnabled:TRUE]; UILabel *aLbl = (UILabel *)[temp viewWithTag:123]; [aLbl setText:[NSString stringWithFormat:@"%d",i]]; // check for today if(currentDayConstant == i && currentMonthConstant == currentMonth && currentYearConstant == currentYear) { [aLbl setTextColor:[UIColor blueColor]]; } else { [aLbl setTextColor:[UIColor colorWithRed:69/255.0 green:2/255.0 blue:71/255.0 alpha:1.0]]; } [temp setTag:i]; grid++; if(grid==35) grid=0; } } And finally viewdidload: - (void)viewDidLoad { [super viewDidLoad]; [self setCalendar]; // set views [self.view1 setFrame:CGRectMake(0,45,320,232)]; [self.view2 setFrame:CGRectMake(0,277,320,232)]; [self.view addSubview:self.view1]; [self.view addSubview:self.view2]; frontView = @"view2"; [self fillCalender:currentMonth weekStarts:currentFirstDay year:currentYear]; frontView = @"view1"; }

    Read the article

  • While saving a PNG image using NSData writetofile saves corrupted data on the iphone disk

    - by jAmi
    I have a number of images (PNG,GIF and JPG) in my Application Resource Bundle. I want some images to be saved in my Documents Directory so i use : imgPath=[documentsDirectoryPath stringByAppendingPathComponent:@"myImage.png"]; if (![fileMgr fileExistsAtPath:imgPath]) { [[fileMgr contentsAtPath:[[NSBundle mainBundle] pathForResource:@"myImage"ofType:@"png"]] writeToFile:imgPath atomically:NO]; } This saves an Image file on my desired Path but this file has an Extra 300 bytes (of maybe junk data) in it which results in a corrupted image... Am i doing something wrong here? This works in the simulator but on the real device the image has some extra 300 bytes. Also a GIF image gets copied nicely and works but this problem occurs for PNG image.

    Read the article

  • iPhone - Switch Tab from UIWebView

    - by user269737
    I have a webview and I want to manually switch to another tab during a specific event. The event is arbitray, but I can't figure out hwo to switch teh tab. On my other views, I have the following code: self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:2]; However, this does not work in my custom UIWebView class. Is there a simple solution to this? Thanks

    Read the article

  • If statement question iphone?

    - by NextRev
    I am creating a game where where you complete shapes and the area gets filled in. However, if there is an enemy bird within your shape, it will not fill in. I want to make it so that if you do trap a bird within your shape, you will lose a life. How can I write an if statement that pretty much says if the below code doesn't take place, then you lose a life. If it helps losing a life is called doDie in my code. -(void)fillMutablePath{ CGPoint movePoint = CGPointFromString([pointsToFillArray objectAtIndex:0]); CGPathMoveToPoint(fillPath, NULL, movePoint.x, movePoint.y); for (int i=0; i<[pointsToFillArray count]; i++) { CGPoint tempPoint = CGPointFromString([pointsToFillArray objectAtIndex:i]); CGPathAddLineToPoint(fillPath, NULL, tempPoint.x, tempPoint.y); } CGContextAddPath(gameViewObj._myContext, fillPath); CGContextFillPath(gameViewObj._myContext); CGPathRelease(fillPath); [pointsToFillArray removeAllObjects]; } if(fillMutablePath doesn't take place when making a shape){ [self doDie]; } Like i said above, the reason fillMutablePath wouldn't take place is because a bird would be trapped within the shape. Any help would be much appreciated!!

    Read the article

  • Get name given a phone number on the iPhone

    - by ganti
    I'm using a TextField where the user types a phone number. When the TextField changes, it should check if this number is already in the phonebook and display the name. So far, my only way is to parse all names and number in a Dict and read it from there. Is there a simpler, more efficient and sophisticated way to do that?

    Read the article

  • iphone - grouping UIImageViews x blocking elements

    - by Mike
    I have to rotate several UIImageViews around a specific center. To accomplish this I am using the famous trick of putting these views as subviews of a larger one and rotating that one. The problem is that these subviews have to detect touches, because each one has buttons on it. The hierarchy is like this LARGE_VIEW | |_____ imageView1 | |_________ button1 | |_________ button2 | |_________ button3 | |_____ imageView2 |_________ button4 |_________ button5 |_________ button6 etc So, to make buttons respond to tap, I had to make this; [LARGE_VIEW setUserInteractionEnabled:YES]; [imageView1 setUserInteractionEnabled:YES]; [imageView2 setUserInteractionEnabled:YES]; ImageView1 and 2 are two vertical rows of buttons on each side of the screen. The problem is that there's another view below LARGE_VIEW and this view is not receiving the taps, because LARGE_VIEW is intercepting them first. I don't need LARGE_VIEW to detect any taps except on the two areas where imageView 1 and 2 are. LARGE_VIEW must let pass taps on the area defined by this rect (52, 0, 768-2*52, 1024). ImageView1 and 2 have this size: 52 pixels wide and 1024 pixels high (iPad). ImageView1's rect is: (0, 0, 52, 1024) and ImageView2's rect is: (768-52, 0, 52, 1024) LARGE_VIEW must let pass taps on the area defined by this rect (52, 0, 768-2*52, 1024). How to solve that? I need LARGE_VIEW detect taps on each rect defined on my previous paragraph and pass these taps to its subviews and just let pass taps outside these rects to the app, so other views BELOW, can detect taps too. thanks.

    Read the article

  • iphone sqlite app startup issues

    - by Futur
    Hi All, I have 4 database catalogues in my app, i will be switching the four catalogues. When i start the app, i read the NSUserDefaults and try to load the default catalogue in the memory, but in the first time this doesnt happen. Instead i get null values returned first time just because the DB connection is not successful for some unknown reason, the debugger is unable to go there too. But the app starts up the next time, the values are fetched successfully. Please help

    Read the article

  • suppress keyboard in iphone UiWebViews

    - by rob
    I have an app that uses UiWebViews, and I need to not show the keyboard for a text field within such a view. I provide my own buttons that insert the limited sorts of text the field allows, but I also need to allow pasting (I will filter what gets pasted) and adjusting the cursor position. Any way to do this?

    Read the article

  • Iphone: controlling text with delay problem with UIWebView

    - by James B.
    Hi, I've opted to use UIWebView so I can control the layout of text I've got contained in a local html document in my bundle. I want the text to display within a UIWebView I've got contained within my view. So the text isn't the whole view, just part of it. Everything runs fine, but when the web page loads I get a blank screen for a second before the text appears. This looks really bad. can anyone give me an example of how to stop this happening? I'm assuming I have to somehow hide the web view until it has fully loaded? Could someone one tell me how to do this? At the moment I'm calling my code through the viewDidLoad like this: [myUIWebView loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"localwebpage" ofType:@"html"] isDirectory:NO]]]; Any help is much appreciated. I've read round a few forums and not seen a good answer to this question, and it seems like it recurs a lot as an issue for beginners like myself. Thanks for taking the time to read this post! UPDATED info Thanks for your response. The suggestions below solves the problem but creates a new one for me as now when my view loads it is totally hidden until I click on my toggle switch. to understand this it's maybe most helpful if I post all my code. Before this though let me explain the setup of my view. I've got a standard view within which I've also got two web views, one on top of the other. each web view contains different text with different styling. the user flicks between views using a toggle switch, which hides/reveals the web views. I'm using the web views because I want to control the style/layout of the text. Below is my full .m code, I can't figure out where it's going wrong. My web views are called oxford & harvard I'm sure its something to do with how/when I'm hiding/revealing views. I've played around with this but can't seem to get it right. Maybe my approach is wrong. A bit of advice ironing this out would be really appreciated: @implementation ReferenceViewController @synthesize oxford; @synthesize harvard; // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; [oxford loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Oxford" ofType:@"html"] isDirectory:NO]]]; [harvard loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Harvard" ofType:@"html"] isDirectory:NO]]]; [oxford setHidden:YES]; [harvard setHidden:YES]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { if([webView hidden]) { [oxford setHidden:NO]; [harvard setHidden:NO]; } } //Toggle controls for toggle switch in UIView to swap between webviews - (IBAction)toggleControls:(id)sender { if ([sender selectedSegmentIndex] == kSwitchesSegmentIndex) { oxford.hidden = NO; harvard.hidden = YES; } else { oxford.hidden = YES; harvard.hidden = NO; } } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; [oxford release]; [harvard release]; } @end

    Read the article

  • Get name given by phone number on the iPhone

    - by ganti
    I'm using a TextField where the user types a phone number. When the TextField changes, it should check if this number is already in the phonebook and display the name. So far, my only way is to parse all names and number in a Dict and read it from there. Is there a simpler, more efficient and sophisticated way to do that?

    Read the article

  • Warning: control reaches end of non-valid function - iPhone

    - by Dave
    I keep getting 'warning: control reaches end of non-void function' with this code: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section ==0) { return [comparativeList count]; } if (section==1) { return [generalList count]; } if (section==2) { return [contactList count]; How can I get rid of this warning? Thanks.

    Read the article

  • iPhone WebApp Question

    - by Henry D'Andrea
    I have this code- /** Save the web view as a screenshot. Currently only supports saving to the photo library. / - (void)saveScreenshot:(NSArray)arguments withDict:(NSDictionary*)options { CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect imageRect = CGRectMake(0, 0, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect)); UIGraphicsBeginImageContext(imageRect.size); [webView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil); UIAlertView *alert= [[UIAlertView alloc] initWithTitle:nil message:@"Image Saved" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } This is for saving whatever you drew in my app. How would I add the button for this in the HTML code. How do i call from it?

    Read the article

  • Creating a unique id for a Core Data program on the iPhone

    - by Big Twisty
    I am fairly new at programming in Objective-C, having been a windows programmer since I was a kid. I am falling in LOVE with it. I am, however, having a bit of trouble figuring out this Core Data stuff. How do I create a new entry with a unique ID? In SQL I would just declare one field as an autoincrement field. I'm not seeing anything like that here, but I could just be missing something. I just want an auto incrementing NSInteger field, so when I manually add items to the database, I will have some form of reference to them.

    Read the article

  • iPhone: Grouping records in multiple UITableView views

    - by Nic Hubbard
    Let me first say, I know how to create sections and group records within a UITableView. What I am wanting to do is something similar to creating a photo album. So, I have all my data objects coming from core data, and, I want to be able to create a custom group, such as "My Trip to Mexico" and "First Birthday". Then, the user should be able to add objects/records into new sections/albums. So, basically the user is creating custom sections with their own custom names, and then choosing what records should go into that section/album. So, I am just wondering what is the best way to do this? I am thinking that I would just create some extra attributes for my core data model. Or, would I create a whole new "Album Section" object, and somehow use that? Point me in the right direction. :)

    Read the article

  • iPhone transparent images rendering poorly

    - by alku83
    I'm developing an iPad application. I have been provided with a PNG image that contains some transparency - basically a drop shadow. The problem I'm having is that this is rendering poorly within the application, both on the device and in the sim. I can't provide the whole image but I've made up some samples to illustrate. The first is how the image appears in the PSD (correctly that is). The second is how it appears on the device. You can see that the strip of shadow in the middle of the image is distinctly more yellow and poorly looking. Any ideas what I'm doing wrong?

    Read the article

  • iPhone tableview: titleForHeaderInSection derived from array

    - by Nic Hubbard
    I have a tableview that is populated by an array. Currently the tableview has no grouping. What I would like to do is check a value of each array object, such as State, and group all the CA items together, all the OR items together, etc. Then, assign those groups a title. The array is dynamic, and will grow and get new values in the future, so I can't hardcode titles, I would like these to somehow come from my initial array. Currently I am using the following, but it does not take into account sorting of the array, or if I removed all of the items in the array that have to do with California. - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if (section == 0) { return @"California"; } else if (section == 1) { return @"Washington"; } else { return @"Utah"; } }//end tableView So, I am confusing myself as to how this would be possible. Any tips would be appreciated.

    Read the article

  • iPhone/Obj-C - Archiving object causes lag

    - by Dylan
    Hi I have a table view, and when I delete a cell I am removing an item from an NSMutableArray, archiving that array, and removing the cell. However, when I do this, it is causing the delete button to lag after I click it. Is there any way to fix this? // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { int row = [indexPath row]; [savedGames removeObjectAtIndex:row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; //this line causing lag [NSKeyedArchiver archiveRootObject:savedGames toFile:[self dataFilePath]]; } } Thanks

    Read the article

  • Add view overlay to iPhone app

    - by Rob Lourens
    I'm trying to do something like this: - (void)sectionChanged:(id)sender { [self.view addSubview:loadingView]; // Something slow [loadingView removeFromSuperview]; } where loadingView is a semi-transparent view with a UIActivityIndicatorView. However, it seems like added subview changes don't take effect until the end of this method, so the view is removed before it becomes visible. If I remove the removeFromSuperview statement, the view shows up properly after the slow processing is done and is never removed. Is there any way to get around this?

    Read the article

  • iPhone How to set a clearcolor for my custom view

    - by user355066
    Hi, I am creating a custom StyleLabel by extending the UIView, which provides a link for particular type of strings. I have successfully implemented this functionality. I am using this label in TableViewCell along with UILabel.i set UILabel & StyleLabel background color is set to clearColor. UILabel works fine, but StyleLabel shows background in blackColor. I am not sure what is the problem with the following code. Here is the drawRect method of CustomLabel class -(void) drawRect:(CGRect)rect { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextClearRect(ctx, rect); [[UIColor clearColor] setFill]; CGContextAddRect(ctx, rect); CGContextDrawPath(ctx, kCGPathFill); [_text drawText:ctx]; } Thanks Sasikumar

    Read the article

  • iPhone, change color to each letter

    - by Paul
    It is possible to change a NSString color by letter? For example, if you have NSString *A=@"ASDFGH"; show in UILabel ASD with red and FGH with blue. And another question.. If I have a NSString, can I access the letter I want? For example, in NSString *A=@"ASDFGH"; how can I know what is the second letter which is S, or the third, which is D?

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >