Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 73/196 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Showing a MKAnnotation for custom object

    - by Chamanhm
    I have a list of objects and each of those has a title, name, description, latitude, longitude and address. Is it possible to show this objects as MKAnnotations? I've been stuck with this for hours now. When I tried to make the objects have a CLLocationCoordinate2D I kept getting the error about latitude or longitude not being assignable. #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface Oficina : NSObject <MKMapViewDelegate> @property (nonatomic, readwrite) CLLocationCoordinate2D oficinaCoordinate; @property (nonatomic, strong) NSString *oficinaCiudad; @property (nonatomic, strong) NSString *oficinaEstado; @property (nonatomic, strong) NSString *oficinaTitulo; @property (nonatomic, strong) NSString *oficinaTelefono; @property (nonatomic, strong) NSString *oficinaLatitud; @property (nonatomic, strong) NSString *oficinaLongitud; @property (nonatomic, strong) NSString *oficinaID; @property (nonatomic, strong) NSString *oficinaDireccion; @property (nonatomic, strong) NSString *oficinaHorario; @property (nonatomic, strong) NSString *oficinaTipoDeOficina; @property (nonatomic, strong) NSString *oficinaServicios; @property (nonatomic, strong) NSString *oficinaTipoDeModulo; @end So after consuming an internet service I get around 70 of these objects. Now I want to be able to turn each of those into a map annotation. This is one of the ways I've tried to assign the latitude but I get the error "Expression not assignable".. currentOffice.oficinaCoordinate.latitude = [parseCharacters floatValue]; Where currentOffice is an instance of my custom object.

    Read the article

  • Odd Segue Behaviour - Not Firing

    - by Zak
    So I've noticed some very weird behaviour from my program. Here's a simplified code snippet and then I'll explain what occurs when built and ran. -(void)viewDidLoad { [super viewDidLoad]; ... if (self.sampleBool) { [self performSegueWithIdentifier:@"mySegue" sender:self]; } else { // do stuff } } ... -(IBAction)myMethod:(UITapGestureRecognizer*)sender { ... [self performSegueWithIdentifier:@"mySegue" sender:self]; } The segue triggers via the UITapGestureRecognizer fine - so I know the segue is linked correctly. However, when self.sampleBool is true and performSegueWithIdentifier is called within viewDidLoad, the segue does not fire. Anyone have any guesses? Any help or advice is appreciated. Thanks

    Read the article

  • Getting a SIGABRT error in dismissModalViewController

    - by mcalleja
    Im receiving a SIGABRT error when I cancel a MFMailComposeViewController, exactly in the dismissViewController, don't work I have a UIViewController within a UINavigationController. My Code: - (void)sendMail { if ([MFMailComposeViewController canSendMail]) { controller = [[MFMailComposeViewController alloc] init]; [[controller navigationBar] setTintColor:[UIColor getHexColorWithRGB:@"e2de09" alpha:1.0f]]; controller.mailComposeDelegate = self; [controller setSubject:@"Subject"]; NSString *msg="xxxxx"; [controller setMessageBody:msg isHTML:YES]; [self presentModalViewController:controller animated:YES]; } else { NSString * errorString = [NSString stringWithFormat:@"mail account not set."]; UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Error:" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [errorAlert show]; } } The presentModalViewController:animated: works correctly. - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [self becomeFirstResponder]; [self dismissModalViewControllerAnimated:YES]; } But calling [self dissmissModalViewControllerAnimatedLYES] causes a SIGABRT error.

    Read the article

  • Changing UIViews during UIInterfaceOrientation on iPad

    - by FreeAppl3
    I am trying to change views on rotation because my views have to be significantly different from portrait to landscape. Now the code I am using works once then the app freezes when trying to rotate back. Either direction does not make a difference. For example: If I am in Landscape and rotate to portrait everything works great until I rotate back to landscape then it freezes and does absolutely nothing. Here is the code I am using to achieve this In my "viewDidLoad" method [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil]; Then I call this for the rotation: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES; } - (void)didRotate:(NSNotification *)notification { UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if ((orientation == UIDeviceOrientationLandscapeLeft) || (orientation == UIDeviceOrientationLandscapeLeft)) { // present the other viewController, it's only viewable in landscape [self.view addSubview:landScapeView]; } if ((orientation == UIDeviceOrientationLandscapeRight) || (orientation == UIDeviceOrientationLandscapeRight)) { // present the other viewController, it's only viewable in landscape [self.view addSubview:landScapeView]; } else if ((orientation == UIDeviceOrientationPortrait || (orientation == UIDeviceOrientationPortrait)) { // get rid of the landscape controller [self.view addSubview:portrait]; } else if ((orientation == UIDeviceOrientationPortraitUpsideDown || (orientation == UIDeviceOrientationPortraitUpsideDown)) { // get rid of the landscape controller [self.view addSubview:portrait]; } }

    Read the article

  • receiving signal: EXC_BAD_ACCESS in web service call function

    - by murali
    I'm new to iPhone development. I'm using xcode 4.2. When I click on the save button, I'm getting values from the html page and my web service is processing them, and then I get the error: program received signal: EXC_BAD_ACCESS in my web service call function. Here is my code: NSString *val=[WebviewObj stringByEvaluatingJavaScriptFromString:@"save()"]; NSLog(@"return value:: %@",val); [adict setObject:[NSString stringWithFormat:@"%i",userid5] forKey:@"iUser_Id" ]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:0] forKey:@"vImage_Url"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:1] forKey:@"IGenre_Id"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:2] forKey:@"vTrack_Name"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:3] forKey:@"vAlbum_Name"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:4] forKey:@"vMusic_Url"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:5] forKey:@"iTrack_Duration_min"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:6] forKey:@"iTrack_Duration_sec"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:7] forKey:@"vDescription"]; NSLog(@"dict==%@",[adict description]); NSString *URL2= @"http://184.164.156.55/Music/Track.asmx/AddTrack"; obj=[[UrlController alloc]init]; obj.URL=URL2; obj.InputParameters = adict; [obj WebserviceCall]; obj.delegate= self; //this is my function..it is working for so many function calls -(void)WebserviceCall{ webData = [[NSMutableData alloc] init]; NSMutableURLRequest *urlRequest = [[ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ]; NSString *httpBody = @""; for(id key in InputParameters) { if([httpBody length] == 0){ httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]]; } else{ httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]]; } } httpBody = [httpBody stringByAppendingFormat:httpBody];//Here i am getting EXC_BAD_ACCESS [urlRequest setHTTPMethod: @"POST" ]; [urlRequest setHTTPBody:[httpBody dataUsingEncoding:NSUTF8StringEncoding]]; [urlRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self]; } Can any one help me please? thanks in advance

    Read the article

  • Define background Image with UIImage

    - by Wohoo Summer
    I am using header file to set the background for my application and I have something like #define backgroundImage [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.jpeg"]] but I want use UIImageView instead of UIColor. I know I can do: UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) [imageView setImage:[UIImage imageNamed:@"background.png"]]; self.tableView.backgroundView = imageView; but how do I use it with #define?

    Read the article

  • sqlite 3 opening issue

    - by anonymous
    I'm getting my data ,with several similar methods, from sqlite3 file like in following code: -(NSMutableArray *) getCountersByID:(NSString *) championID{ NSMutableArray *arrayOfCounters; arrayOfCounters = [[NSMutableArray alloc] init]; @try { NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *databasePath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"DatabaseCounters.sqlite"]; BOOL success = [fileManager fileExistsAtPath:databasePath]; if (!success) { NSLog(@"cannot connect to Database! at filepath %@",databasePath); } else{ NSLog (@"SUCCESS getCountersByID!!"); } if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK){ NSString *tempString = [NSString stringWithFormat:@"SELECT COUNTER_ID FROM COUNTERS WHERE CHAMPION_ID = %@",championID]; const char *sql = [tempString cStringUsingEncoding:NSASCIIStringEncoding]; sqlite3_stmt *sqlStatement; int ret = sqlite3_prepare(database, sql, -1, &sqlStatement, NULL); if (ret != SQLITE_OK) { NSLog(@"Error calling sqlite3_prepare: %d", ret); } if(sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL) == SQLITE_OK){ while (sqlite3_step(sqlStatement)==SQLITE_ROW) { counterList *CounterList = [[counterList alloc]init]; CounterList.counterID = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,0)]; [arrayOfCounters addObject:CounterList]; } } else{ NSLog(@"problem with database prepare"); } sqlite3_finalize(sqlStatement); } else{ NSLog(@"problem with database openning %s",sqlite3_errmsg(database)); } } @catch (NSException *exception){ NSLog(@"An exception occured: %@", [exception reason]); } @finally{ sqlite3_close(database); return arrayOfCounters; } //end } then i'm getting access to data with this and other similar lines of code: myCounterList *MyCounterList = [[myCounterList alloc] init]; countersTempArray = [MyCounterList getCountersByID:"2"]; [countersArray addObject:[NSString stringWithFormat:@"%@",(((counterList *) [countersTempArray objectAtIndex:i]).counterID)]]; I'm getting a lot of data like image name and showing combination of them that depends on users input with such code: UIImage *tempImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_0.jpg",[countersArray objectAtIndex:0]]]; [championSelection setBackgroundImage:tempImage forState:UIControlStateNormal]; My problem: When i'm run my app for some time and get a lot of data it throws error: " problem with database openning unable to open database file - error = 24 (Too many open files)" My guess is that i'm opening my database every time when getCountersByID is called but not closing it. My question: Am i using right approach to open and close database that i use? Similar questions that have not helped me to solve this problem: unable to open database Sqlite Opening Error : Unable to open database UPDATE: I made assumption that error is showing up because i use this lines of code too much: NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *databasePath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"DatabaseCounters.sqlite"]; BOOL success = [fileManager fileExistsAtPath:databasePath]; and ending up with error 24. So i made them global but sqlite3_errmsg shows same err 24, but app runs much faster now I'll try to debug my app, see what happens

    Read the article

  • how to fetch data from Plist in Label

    - by SameSung Vs Iphone
    I have a RegistrationController screen to store email-id ,password,DOB,Height,Weight and logininController screen to match email-id and password to log-in purpose. Now In some third screen I have to fetch only the Height,Weight from the plist of the logged-in user to display it on the label.now if I Store the values of email-id and password in from LoginViewController in string and call it in the new screen to match if matches then gives Height,Weight ..if it corrects then how to fetch Height,Weight from the plist of the same one. how can i fetch from the stored plist in a string... the code which i used to match in LoginController -(NSArray*)readFromPlist { NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [documentPaths objectAtIndex:0]; NSString *documentPlistPath = [documentsDirectory stringByAppendingPathComponent:@"XYZ.plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:documentPlistPath]; NSArray *valueArray = [dict objectForKey:@"title"]; return valueArray; } - (void)authenticateCredentials { NSMutableArray *plistArray = [NSMutableArray arrayWithArray:[self readFromPlist]]; for (int i = 0; i< [plistArray count]; i++) { id object = [plistArray objectAtIndex:i]; if ([object isKindOfClass:[NSDictionary class]]) { NSDictionary *objDict = (NSDictionary *)object; if ([[objDict objectForKey:@"pass"] isEqualToString:emailTextFeild.text] && [[objDict objectForKey:@"title"] isEqualToString:passwordTextFeild.text]) { NSLog(@"Correct credentials"); return; } NSLog(@"INCorrect credentials"); } else { NSLog(@"Error! Not a dictionary"); } } }

    Read the article

  • Creation of model in core data on the fly

    - by user1740045
    How can we create a model in core data on the fly? I.e getting the schema of database from somewhere and then creating a Core Data Object graph? *QuesTion:* Yes thats fine, agreed with all the advantages. But, can anybody can tell practically, what is the benefit of integrating Core Data into project instead of using SQL directly. 1.No need to write SQL boiler plate code [but need to learn Core Data Model (steep curve)] 2.WE can undo and redo changes [but practically who needs it] 3.we can migrate to another schema [that can be done by SQLite as well jus need to add another field into table] 4.For say aggregation on some field in table,in Core Data we need to loop through Core Data Objects whereas in SQLite we need to first write SQLite Boiler Plate Code and then the basic aggregation SQL query,which is easy to write,only length of code will increase...But in case of Core Data (need to learn a lot). So apart from reducing the length of Code,does it actually adds value to project? or in terms of Memory Efficiency,Performance,etc.. PS: If anybody has actualy worked on Core Data(Model Creation On the Fly) , if possible share and gve pointers..thanks!

    Read the article

  • How to set only the first cell of a UITableView to a different color?

    - by Ted
    I use cellForRowAtIndexPath like here: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) cell = [self getCellContentView:CellIdentifier]; UILabel *lbl = (UILabel*)[cell.contentView viewWithTag:1]; for (UITableViewCell *c in [tbl visibleCells]) { // UITableViewCell *cell2 = [tbl cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]]; UILabel *lbl = (UILabel*)[c.contentView viewWithTag:1]; lbl.textColor = [UIColor redColor]; } if([tbl indexPathForCell:cell].section==0) lbl.textColor = [UIColor whiteColor]; UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1]; UILabel *lblTemp2 = (UILabel *)[cell viewWithTag:2]; //First get the dictionary object lblTemp1.text = @"test!"; lblTemp2.text = @"testing more"; NSLog(@"%@",[tbl indexPathForCell:cell]); return cell; } But is still makes some of my cells white instead of gray. How can I change only the first item in the row to white?

    Read the article

  • plus minus table View cell

    - by user1748387
    I have the following code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; UIImage * i1 = [UIImage imageNamed: @"inc_01.png"]; UIImage * i2 = [UIImage imageNamed: @"inc_02.png"]; UIImage * i3 = [UIImage imageNamed: @"inc_04.png"]; UIImage * i5 = [UIImage imageNamed: @"inc_05.png"]; UIImage * i6 = [UIImage imageNamed: @"inc_06.png"]; UIImage * i7 = [UIImage imageNamed: @"inchd.png"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if(indexPath.row == 0) { UIImageView * header= [[UIImageView alloc] initWithImage: i1]; cell.backgroundView = header; // Configure the cell… } else if (indexPath.row == 2) { UIImageView *backgroundCellImage=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 280, 11)]; backgroundCellImage.image=[UIImage imageNamed:@"inc_06.png"]; [cell.contentView addSubview:backgroundCellImage]; } else { // Configure the cell… UIImageView *imageView = [[UIImageView alloc] initWithImage: i3]; cell.textLabel.text = @"text"; UIImageView *backgroundCellImage=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 57, 46)]; backgroundCellImage.image=[UIImage imageNamed:@"inc_02.png"]; UIImageView *backgroundCellImage2=[[UIImageView alloc] initWithFrame:CGRectMake(223, 0, 57, 46)]; backgroundCellImage2.image=[UIImage imageNamed:@"inc_04.png"]; UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(57, 0, 166, 46)]; label.text = @"wow"; [cell.contentView addSubview:backgroundCellImage]; [cell.contentView addSubview:backgroundCellImage2]; [cell.contentView addSubview:label]; } return cell; } that basically creates a table view and puts an image to the left and right of each cell. I want it so that people can click on the left or right image in each cell, and something different happens based on the cell number. So if they click on the left image for cell in row 1, a function gets call with the row number they clicked on, and an indicator telling me they clicked on the left image and not the right image. How can I do that using objective-c?

    Read the article

  • Call IBAction in other method

    - by user1628083
    I have an IBAction of SignIn and Method getData. When load it call SignIn into method Getdata in case I want auto sign in without click button Sign In. -(void)getData {       if ([_remCheckbox state] == NSOnState)     {         NSUserDefaults *store = [NSUserDefaults standardUserDefaults];                  NSString *un = [store objectForKey:@"usrname"];         NSString *pw = [store objectForKey:@"usrpwd"];                  _txtUsername.stringValue = un;         _txtPwd.stringValue = pw;                  //call event IBAction              }   } - (IBAction)buttonSignIn:(id)sender {     //Signin code suppose to work fine }

    Read the article

  • Content Alignment Issue in UITableView cell

    - by OhhMee
    Please see the image attached. I don't understand why it's going outside. I've also attached code snippet for tableView. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; // cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; } // Configure the cell. hNode* dCell = [array objectAtIndex:[indexPath row]]; cell.textLabel.text = @"Message"; cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",[dCell contents]]; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; cell.detailTextLabel.numberOfLines = 0; [[cell imageView] setImage:[UIImage imageNamed:@"user.png"]]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath { return 60; } Where could be the issue?

    Read the article

  • How to compare 2 button title using index or tag value

    - by fasil moham
    Here my application i having set of button 12 buttons,button titles are hidden by default.Button titles are shown when it is clikced , -(IBAction)buttonAction:(id)sender { UIButton *button = (UIButton *)sender; int index = button.tag; [self showing:index]; //now, this method accepts a parameter. } -(void) showing:(NSInteger)index { UIButton* btn = nil; index = index - 1; NSArray* subViewArray = [self.view subviews]; NSInteger i = 0; for (UIView *view in subViewArray) { if ([view isKindOfClass:[UIButton class]]) { btn = (UIButton*) view; NSString* text; if (i == index) { text = [self.textArray objectAtIndex:i]; //put the array that you are using self.previousButtonTag = i; //make a class variable }else { text = @""; } i++; [btn setTitle:text forState:UIControlStateNormal]; } } } 1.I want to compare two button title values to check whether it is equal or not.Im facing the problem , 2.Only press button title only visible,when i click other button previous title is hided,I want to enable two button title on click and wen it is wrong it should be hided.Please suggest me the How to solve this issue,Please do the needfully

    Read the article

  • How to upload a file with JQueryMobile for an iphone/ipad?

    - by JD
    Hi, I have just started looking at JqueryMobile and want to know if the following is possible? I want to be able to select a file (similar to in html) and then show some sort of dialogue that allows me to browse to a "folder" and select the file. It would then be up to me to send some sort of AJAX command to upload it to the server (where I am using Asp.net MVC 2) Since I do not have access to an iPhone or iPad, I was told that I would only have access to the documents folder. JD

    Read the article

  • UITableView headings shown on top of MBProgressHUD

    - by Chris Ballinger
    So I have a subclass of UITableViewController that loads some data from the internet and uses MBProgressHUD during the loading process. I use the standard MBProgressHUD initialization. HUD = [[MBProgressHUD alloc] initWithView:self.view]; [self.view addSubview:HUD]; HUD.delegate = self; HUD.labelText = @"Loading"; [HUD show:YES]; This is the result: . Is there any way to resolve this issue, or should I just abandon MBProgressHUD? Thanks!

    Read the article

  • Storyboard changing controller (modal) not working

    - by BrandNew
    I have problem with navigation between ViewControllers: here is my storyboard: http://postimg.org/image/dar9pkuvl/ The navigation between controllers in green rectangle works fine, I add to controller number 1 controller number 2 (by addtosubview) and then controllers number 3,4,5 to UIScrollView in controller number 2 ( controller number 2 contain scrollview). Everything work fine but if I click Send buttn on controller 4 nothing happens (It is strange because I was added connection between button and controller in the same way like between controllers 7 and 8). I know it is little bit confusing described, but I hope that someone tell me where is problem. Thanks

    Read the article

  • Iphone app getting crashing when i enter the iphone mail sheet

    - by Gopinath
    In my iphone app. I'm Creating Iphone Mail Chat Sheet using MFMailComposeViewController. Now when I enter the second time,the mail sheet, my app is getting crashed. I searched in Google. But I couldn't find the solution. Anybody help me to solve my issue. PLease see this below code and help me where am I doing wrong. if ([MFMailComposeViewController canSendMail]) { controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; [controller setSubject:@""]; [controller setToRecipients:array1]; [controller setMessageBody:@"" isHTML:NO]; [controller setMailComposeDelegate: self]; [controller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; [self.navigationController presentModalViewController:controller animated:NO]; [controller release]; } - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { if(result == MFMailComposeResultSent) { [[self parentViewController] dismissModalViewControllerAnimated:YES]; } else if (result == MFMailComposeResultCancelled) { [[self parentViewController] dismissModalViewControllerAnimated:YES]; } }

    Read the article

  • Portrait video to landscape

    - by dappa
    I am aware questions like this one may already be out there but for the sake of others like me I will go ahead and ask I have a app that is set to only allow portrait orientation but this setting affects my videos as I would like only the videos to be able to play in landscape also. Is there a method I can add unto my .m file to make this work? Here is my code; #import "BIDVideosViewController.h" @interface BIDVideosViewController () @end @implementation BIDVideosViewController @synthesize moviePlayer ; @synthesize tableList; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; UITableView *table = [[UITableView alloc]initWithFrame:self.view.bounds]; [table setDelegate:self]; [table setDataSource:self]; [self.view addSubview:table]; tableList = [[NSMutableArray alloc] initWithObjects:@"Gangan",@"SwimGood",@"German Ice", nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [tableList count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *DisclosureButtonIdentifier = @"DisclosurebutotonIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DisclosureButtonIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DisclosureButtonIdentifier]; } NSInteger row = [indexPath row]; NSString *rowString = [tableList objectAtIndex:row]; cell.textLabel.text = rowString; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { { NSBundle *str = [tableList objectAtIndex:indexPath.row]; if ([str isEqual:@"Gangan"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"Gangan" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } else if ([str isEqual:@"SwimGood"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"SwimGood" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } else if ([str isEqual:@"German Ice"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"German Ice" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } } } @end

    Read the article

  • UITableViewController executes delate functions before network request finishes

    - by user1543132
    I'm having trouble trying to populate a UITableView with the results of a network request. It seems that my code is alright as it works perfectly when my network is speedy, however, when it's not, the function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath- still executes, which results in a bad access error. I presume that this is because the array that the aforesaid function attempts to utilize has not been populated. This brings me to my question: Is there anyway that I can have the UITableView delegate methods delayed to avoid this? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"AlbumsCell"; //UITableViewCell *basicCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; AlbumsCell *cell = (AlbumsCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { **// Here is where the Thread 1: EXC_BAD_ACCESS (code=2 address=0x8)** cell = [[[AlbumsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } Album *album = [_albums objectAtIndex:[indexPath row]]; [cell setAlbum:album]; return cell; }

    Read the article

  • How to call a method after asynchronous task is complete

    - by doctordoder
    I have a class called WikiWebView which is a subclass of UIWebView which loads Wikipedia subjects and is designed to fetch all the links of the webpage, in order to create a sort of site map for the subject. My problem is that I can only create the links once the web page has loaded, but the loading isn't done right after [self loadRequest:requestObj] is called. - (void)loadSubject:(NSString *)subject { // load the actual webpage NSString *wiki = @"http://www.wikipedia.org/wiki/"; NSString *fullURL = [wiki stringByAppendingString:subject]; NSURL *url = [NSURL URLWithString:fullURL]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [self loadRequest:requestObj]; // [self createLinks]; // need this to be called after the view has loaded } - (void)createLinks { NSString *javascript = @"var string = \"\";" "var arr = document.getElementsByClassName(\"mw-redirect\");" "for (var i = 0; i < arr.length; ++i)" "{" "var redirectLink = arr[i].href;" "string = string + redirectLink + \" \";" "}" "string;"; NSString *links = [self stringByEvaluatingJavaScriptFromString:javascript]; self.links = [links componentsSeparatedByString:@" "]; } I tried the normal delegation technique, which lead to this code being added: - (id)init { if (self = [super init]) { self.delegate = self; // weird } return self; } #pragma mark - UIWebViewDelegate - (void)webViewDidStartLoad:(UIWebView *)webView { ++_numProcesses; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { --_numProcesses; } - (void)webViewDidFinishLoad:(UIWebView *)webView { --_numProcesses; if (_numProcesses == 0) { [self createLinks]; } } However, the delegate methods are never called.. I've seen similar questions where the answers are to use blocks, but how would I do that in this case?

    Read the article

  • Can't give my custom prototype cells in tableview different heights

    - by kerbelda
    I've looked around at other questions here and many other sources online and just can't find a solution. I have 3 rows and no matter what I do, they all keep the width defined in the tableview. The first one is what I want, but the second and 3rd I can't give a custom height. Below is my code: #import "DetailTableViewController.h" #import "EventDetailTableViewCell.h" #import "EventDescriptionTableViewCell.h" #import "EventMapTableViewCell.h" @interface DetailTableViewController () @end @implementation DetailTableViewController - (void)viewDidLoad { [super viewDidLoad]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 3; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { static NSString *CellIdentifier = @"headerCell"; EventDetailTableViewCell *headerCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; headerCell.headerImage.image = [UIImage imageNamed:@"img4.png"]; return headerCell; } else if (indexPath.section == 1) { static NSString *CellIdentifier = @"descriptionCell"; EventDescriptionTableViewCell *descriptionCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; descriptionCell.descriptionImage.image = [UIImage imageNamed:@"img2.png"]; return descriptionCell; } else { static NSString *CellIdentifier = @"mapCell"; EventMapTableViewCell *mapCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; return mapCell; } } #pragma mark - Helper Methods - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if (section == 1) { return @" "; } else if (section == 2) { return @" "; } else { return nil; } } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 0) { return 222; } else if (indexPath.row == 1) { return 80; } else { return 100; } } @end

    Read the article

  • UISearchBarDisplayController - Fixed SearchBar

    - by slik
    I've been trying to get UISearchBarDisplayController to not animate, and stay fixed below the navigation bar. Is this even possible, I've been getting some weird results. This is all configured through a storyboard. I am just trying to figure out If I should just create my own implementation of UISearchBarDisplayController since it kinda seems a little impossible to customize it to my need. Clicking the search box When I start searching the top has extra paddding (20pt). It's assuming its on top of the origin y: 0 to prevent overlapping of status bar. I can't click outside or the cancel, x buttons. What happens If I click cancel, before searching

    Read the article

  • Facebook og:image

    - by Roderick Standaart
    So i have a problem with the facebook og:image. site: http://images.vallo-app.com/4db279b31df280b/ if people use this link to show their image, its no problem, facebook loads the og:image But it is used in an iPhone App, so people make a picture and get a shortened url of bit.ly back and then they can post it. So if you post it, facebook juts doesn't show the preview of the image, but if you post that shortened bit.ly link on facebook.com in the statusupdate it does. Someone know what the problem is?

    Read the article

  • How to do something when AVQueuePlayer finishes the last playeritem

    - by user1634529
    I've got an AVQueuePlayer which I'm creating from an array of 4 AVPlayerItems, and it all plays fine. I want to do something when the last item in the queue finishes playing, I've looked a load of answers on here and this is the one that looks most promising for what I want: The best way to execute code AFTER a sound has finished playing In my button handler i have this code: static const NSString *ItemStatusContext; [thePlayerItemA addObserver:self forKeyPath:@"status" options:0 context:&ItemStatusContext]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd) name:AVPlayerItemDidPlayToEndTimeNotification object:thePlayerItemA]; theQueuePlayer = [AVQueuePlayer playerWithPlayerItem:thePlayerItemA]; [theQueuePlayer play]; and then I have a function to handle playerItemDidReachEnd: - (void)playerItemDidReachEnd:(NSNotification *)notification { // Do stuff here NSLog(@"IT REACHED THE END"); } But when I run this I get an Internal Inconsistency Exception: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: status Observed object: <AVPlayerItem: 0x735a130, asset = <AVURLAsset: 0x73559c0, URL = file://localhost/Users/mike/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/A0DBEC13-2DA6-4887-B29D-B43A78E173B8/Phonics%2001.app/yes.mp3>> Change: { kind = 1; } What am I doing wrong?

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >