Search Results

Search found 7409 results on 297 pages for 'corona sdk'.

Page 23/297 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Retrieving a list of eBay categories using the .NET SDK and GetCategoriesCall

    - by Bill Osuch
    eBay offers a .Net SDK for its Trading API - this post will show you the basics of making an API call and retrieving a list of current categories. You'll need the category ID(s) for any apps that post or search eBay. To start, download the latest SDK from https://www.x.com/developers/ebay/documentation-tools/sdks/dotnet and create a new console app project. Add a reference to the eBay.Service DLL, and a few using statements: using eBay.Service.Call; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; I'm assuming at this point you've already joined the eBay Developer Network and gotten your app IDs and user tokens. If not: Join the developer program Generate tokens Next, add an app.config file that looks like this: <?xml version="1.0"?> <configuration>   <appSettings>     <add key="Environment.ApiServerUrl" value="https://api.ebay.com/wsapi"/>     <add key="UserAccount.ApiToken" value="YourBigLongToken"/>   </appSettings> </configuration> And then add the code to get the xml list of categories: ApiContext apiContext = GetApiContext(); GetCategoriesCall apiCall = new GetCategoriesCall(apiContext); apiCall.CategorySiteID = "0"; //Leave this commented out to retrieve all category levels (all the way down): //apiCall.LevelLimit = 4; //Uncomment this to begin at a specific parent category: //StringCollection parentCategories = new StringCollection(); //parentCategories.Add("63"); //apiCall.CategoryParent = parentCategories; apiCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); CategoryTypeCollection cats = apiCall.GetCategories(); using (StreamWriter outfile = new StreamWriter(@"C:\Temp\EbayCategories.xml")) {    outfile.Write(apiCall.SoapResponse); } GetApiContext() (provided in the sample apps in the SDK) is required for any call:         static ApiContext GetApiContext()         {             //apiContext is a singleton,             //to avoid duplicate configuration reading             if (apiContext != null)             {                 return apiContext;             }             else             {                 apiContext = new ApiContext();                 //set Api Server Url                 apiContext.SoapApiServerUrl = ConfigurationManager.AppSettings["Environment.ApiServerUrl"];                 //set Api Token to access eBay Api Server                 ApiCredential apiCredential = new ApiCredential();                 apiCredential.eBayToken = ConfigurationManager.AppSettings["UserAccount.ApiToken"];                 apiContext.ApiCredential = apiCredential;                 //set eBay Site target to US                 apiContext.Site = SiteCodeType.US;                 return apiContext;             }         } Running this will give you a large (4 or 5 megs) XML file that looks something like this: <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">    <soapenv:Body>       <GetCategoriesResponse >          <Timestamp>2012-06-06T16:03:46.158Z</Timestamp>          <Ack>Success</Ack>          <CorrelationID>d02dd9e3-295a-4268-9ea5-554eeb2e0e18</CorrelationID>          <Version>775</Version>          <Build>E775_CORE_BUNDLED_14891042_R1</Build> -          <CategoryArray>             <Category>                <BestOfferEnabled>true</BestOfferEnabled>                <AutoPayEnabled>true</AutoPayEnabled>                <CategoryID>20081</CategoryID>                <CategoryLevel>1</CategoryLevel>                <CategoryName>Antiques</CategoryName>                <CategoryParentID>20081</CategoryParentID>             </Category>             <Category>                <BestOfferEnabled>true</BestOfferEnabled>                <AutoPayEnabled>true</AutoPayEnabled>                <CategoryID>37903</CategoryID>                <CategoryLevel>2</CategoryLevel>                <CategoryName>Antiquities</CategoryName>                <CategoryParentID>20081</CategoryParentID>             </Category> (etc.) You could work with this, but I wanted a nicely nested view, like this: <CategoryArray>    <Category Name='Antiques' ID='20081' Level='1'>       <Category Name='Antiquities' ID='37903' Level='2'/> </CategoryArray> ...so I transformed the xml: private void TransformXML(CategoryTypeCollection cats)         {             XmlElement topLevelElement = null;             XmlElement childLevelElement = null;             XmlNode parentNode = null;             string categoryString = "";             XmlDocument returnDoc = new XmlDocument();             XmlElement root = returnDoc.CreateElement("CategoryArray");             returnDoc.AppendChild(root);             XmlNode rootNode = returnDoc.SelectSingleNode("/CategoryArray");             //Loop through CategoryTypeCollection             foreach (CategoryType category in cats)             {                 if (category.CategoryLevel == 1)                 {                     //Top-level category, so we know we can just add it                     topLevelElement = returnDoc.CreateElement("Category");                     topLevelElement.SetAttribute("Name", category.CategoryName);                     topLevelElement.SetAttribute("ID", category.CategoryID);                     rootNode.AppendChild(topLevelElement);                 }                 else                 {                     // Level number will determine how many Category nodes we are deep                     categoryString = "";                     for (int x = 1; x < category.CategoryLevel; x++)                     {                         categoryString += "/Category";                     }                     parentNode = returnDoc.SelectSingleNode("/CategoryArray" + categoryString + "[@ID='" + category.CategoryParentID[0] + "']");                     childLevelElement = returnDoc.CreateElement("Category");                     childLevelElement.SetAttribute("Name", category.CategoryName);                     childLevelElement.SetAttribute("ID", category.CategoryID);                     parentNode.AppendChild(childLevelElement);                 }             }             returnDoc.Save(@"C:\Temp\EbayCategories-Modified.xml");         } Yes, there are probably much cleaner ways of dealing with it, but I'm not an xml expert… Keep in mind, eBay categories do not change on a regular basis, so you should be able to cache this data (either in a file or database) for some time. The xml returns a CategoryVersion node that you can use to determine if the category list has changed. Technorati Tags: Csharp, eBay

    Read the article

  • Install iphone sdk DMG file on iMac but I can't find where any of the programs are located

    - by Tawani
    I just download the iPhone DMG file from apple and installed in on my new iMac (by following these directions: link text). The problem is, I can't seem to find where any of the programs got installed. I can't find XCode or Interface Builder in the applications list and everytime I click on the "iPhone SDK" icon in the applications list, it re-opens finder with the same packages that I am trying to install. P/S: I am completely new to the the Mac world so I might be doing everything completely wrong.

    Read the article

  • Problem with video playback on iPad with MPMoviePlayerViewController

    - by Symo
    Hello everybody... I have been fighting some code for about a week, and am hoping that someone else may have experienced this problem and can point me in the right direction. I am using the MPMoviePlayerViewController to play a video on the iPad. The primary problem is that it works FLAWLESSLY on the iPad Simulator, but will not play at all on the iPad. I have tried re-encoding the video to make sure that isn't an issue. The video I'm using is currently a 480x360 video encoded with H.264 Basline 3.0 with AAC/LC audio. The video plays fine on the iPhone, and also does play through Safari on the iPad. The video actually loads, and you can scrub through the video with the scrubber bar and see that it is there. The frames actually display, but just will not play. If you click play, it just immediately stops. Even when I have mp.moviePlayer.shouldAutoplay=YES set, you can see the player attempt to play, but only for a split second (maybe 1 frame?). I have tried just adding view with the following code: in .h ------ MPMoviePlayerViewController *vidViewController; @property (readwrite, retain) MPMoviePlayerViewController *vidViewController; in .m ------ MPMoviePlayerViewController *mp=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:videoURL]]; [mp shouldAutorotateToInterfaceOrientation:YES]; mp.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; mp.moviePlayer.shouldAutoplay=YES; mp.moviePlayer.controlStyle=MPMovieControlStyleFullscreen; [videoURL release]; self.vidViewController = mp; [mp release]; [self.view addSubview:vidViewController.view]; float w = self.view.frame.size.width; float h = w * 0.75; self.vidViewController.view.frame = CGRectMake(0, 0, w, h); I have also just tried to do a: [self presentMoviePlayerViewControllerAnimated:self.vidViewController]; which I actually can not get to orient properly...always shows up in Portrait and almost completely off the screen on the bottom, and the app is only intended to run in either of the Landscape views... If anybody needs more info, just let me know. I'm about at my wits end on this. ANY help will be GREATLY appreciated.

    Read the article

  • iphone - direct link to iPhone review form from inside iphone

    - by Mike
    I am trying to link directly to the review link of one of my Apps. I know that it is possible because Appirater did it in the past, but some change in iTunes turned the API down. Appirater uses this URL NSString *templateReviewURL = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"; where APP_ID is the ID of an application. running this from inside the APP gives me the message Cannot Connect to iTunes Store. This Page talks about another kind of link https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/addUserReview?id=APP_ID&type=Purple+Software and also itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID The first one works, but just from the desktop mac. The second gives me the same error as the first... Cannot Connect to iTunes Store. iTunes link maker is not helping too, because it has no tools for iPad links... Do you guys know how to link to an app's review form from inside an app? In case you don't know, what kind of package should I use to dig this? a package sniffer? thanks for any help.

    Read the article

  • An offscreen MKMapView behaves differently in 3.2, 4.0

    - by Duane Fields
    In 3.1 I've been using an "offscreen" MKMapView to create map images that I can rotate, crop and so forth before presenting them the user. In 3.2 and 4.0 this technique no longer works quite right. Here's some code that illustrates the problem, followed by my theory. // create map view _mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, MAP_FRAME_SIZE, MAP_FRAME_SIZE)]; _mapView.zoomEnabled = NO; _mapView.scrollEnabled = NO; _mapView.delegate = self; _mapView.mapType = MKMapTypeSatellite; // zoom in to something enough to fill the screen MKCoordinateRegion region; CLLocationCoordinate2D center = {30.267222, -97.763889}; region.center = center; MKCoordinateSpan span = {0.1, 0.1 }; region.span = span; _mapView.region = region; // set scrollview content size to full the imageView _scrollView.contentSize = _imageView.frame.size; // force it to load #ifndef __IPHONE_3_2 // in 3.1 we can render to an offscreen context to force a load UIGraphicsBeginImageContext(_mapView.frame.size); [_mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIGraphicsEndImageContext(); #else // in 3.2 and above, the renderInContext trick doesn't work... // this at least causes the map to render, but it's clipped to what appears to be // the viewPort size, plus some padding [self.view addSubview:_mapView]; #endif when the map is done loading, I snap picture of it and stuff it in my scrollview - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { NSLog(@"[MapBuilder] mapViewDidFinishLoadingMap"); // render the map to a UIImage UIGraphicsBeginImageContext(mapView.bounds.size); // the first sub layer is just the map, the second is the google layer, this sublayer structure might change of course [[[mapView.layer sublayers] objectAtIndex:0] renderInContext:UIGraphicsGetCurrentContext()]; // we are done with the mapView at this point, we need its ram! _mapView.delegate = nil; [_mapView release]; [_mapView removeFromSuperview]; _mapView = nil; UIImage* mapImage = [UIGraphicsGetImageFromCurrentImageContext() retain]; UIGraphicsEndImageContext(); _imageView.image = mapImage; [mapImage release], mapImage = nil; } The first problem is that in 3.1 rendering to a context would trigger the map to begin loading. This no longer works in 3.2, 4.0. The only thing I have found would trigger the load is to temporarily add the map to the view (i.e. make it visible). The problem being that the map only renders to the visible area of the screen, plus a little padding. The frame/bounds are fine, but it appears to be "helpfully" optimizes the loading to limit the tiles to those visible on the screen or close to it. Any ideas how to force the map to load at full size? Anyone else have this issue?

    Read the article

  • iphone - MPMoviePlayerController currentPlaybackTime problem

    - by Mike
    I have a MPMoviePlayerController in my project. Some times, when I order the controller to go to a specific frame, for example [myMovie setCurrentPlaybackTime:16.32]; it goes not to this position, but to a point before the specified point. I think it goes to the nearest keyframe. How can I force the video to stop doing this and go to the precise location? Is there any hope of solving this? thanks for any help.

    Read the article

  • App not installed...because its resources have been modified

    - by brettr
    One user cannot install my app because they continue to receive the error: The application “myapp” was not installed on the iPhone “myPhone” because its resources have been modified I've read the error occurs because of adding files after the app is built. I have not added any files. Last week, the user could install the ad hoc without issue. Any ideas?

    Read the article

  • view .doc, .docx, .rtf, .ppt file in iphone using Webview

    - by Ekra
    Hi friends I want to view .doc, .docx, .rtf, .ppt file in iphone. But I guess something is going wrong at my side and its not working for the above formats but my code is working fine for .txt and .pdf files. I have the read the document regarding Webview it states it supports viewing of the above document. below is my snippet for .doc [webView loadData:requestData MIMEType:@"application/msword" textEncodingName:@"UTF-8" baseURL:nil]; for .ppt I am using MIME type as "application/vnd.ms-powerpoint" Note: If I am making MIME type as "text/html" for .doc then it displays some garbage data So I think there is something missing in MIME type from my side. Any help is highly appreciated. Waiting for your reply.

    Read the article

  • iPhone Inspiration Stories...

    - by Luis Tovar
    So we have all heard of these overnight millionaires in the app store. We know it would be great, but somewhat unlikely to do ourselves. What I do know is, that learning and developing for the iPhone can sometimes be overwhelming. I continue to push on and learn more and more, even when my brain just cant take anymore I turn my mac on and read up on how to do new and different things I haven't done yet in my app yet. I would like to see a few post's of a common day developer's story and how their life has improved now that they are sitting up on the golden pedestal of an iphone developer. I look at these Dice.com jobs on think how nice it would be to be making that kind of money offered for an experienced iphone developer. Im on my way... and while I'm on that road i'd like to look over and see your story... Please include how you got into iPhone development and any apps you have out there and your success with them. Care to share?

    Read the article

  • Should we required to check iPhone is jailbraked

    - by Nirmal
    Hello All... Some of our application is already in AppStore... But suddenly one thing comes into my mind, that I want to clear before submitting my next application. The thing is : As a programmer's point of view, should we require to handle if iPhone Device is jailbreaked ? If yes, then how we can tackle with this ? Thanks in advance....

    Read the article

  • ListView setOnItemClickListener and setOnItemSelectedListener to store the Selected Item Index

    - by Christophe
    Hi all, I have read on this site that it is necessary to customize the setOnItemSelectedListener and setOnItemClickListener of a ListView if we want to know the Index of the SelectedItem (.getSelectedItemPosition()). So that is what I do but it does not stores the position of the SekectedItem, instead i have always -1... What I want to do is just to give the user a way to delete items from a list by selected and Item and Clicking a button. See the code below : listViewPeople.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int i, long l) { try { // Remembers the selected Index listViewPeopleId = listViewPeople.getSelectedItemPosition(); } catch(Exception e) { System.out.println("Nay, cannot get the selected index"); } } }); listViewPeople.setOnItemSelectedListener(new ListView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> a, View v, int i, long l) { try { // Remembers the selected Index listViewPeopleId = listViewPeople.getSelectedItemPosition(); System.out.println("Yay, set the selected index " + listViewPeopleId); } catch(Exception e) { System.out.println("Nay, cannot get the selected index " + listViewPeopleId); } } @Override public void onNothingSelected(AdapterView<?> arg0) { try { // Remembers nothing selected listViewPeopleId = -1; System.out.println("Yay, set that nothing is selected " + listViewPeopleId); } catch(Exception e) { System.out.println("Nay, cannot set that nothing is selected " + listViewPeopleId); } } }); What's wrong?? Thank you for your help! Christophe

    Read the article

  • How to edit .doc file in iPhone

    - by Ekra
    H Friends, I want to edit the .doc files in iPhone and retain its format. I know its possible as many applications like "Documents to go" supports this. I am able to view this type of files currently. Any hint in right direction would be highly appreciated. Thanks in advance

    Read the article

  • iphone app custom images inside UILabel

    - by Ayaz Alavi
    Hi, I have got scenario where i would like to find where text in UILabel is ending and get its coordinates in terms of x and y. Then I need to insert image right after last word of UILabel text. This event will be fired when I click on particular image in app. How can I find what are the x and y of ending character of UILabel text? Regards ayaz alavi

    Read the article

  • managing images in an iphone/ipad universal app

    - by taber
    Hi, I'm just curious as to what methods people are using to dynamically use larger or smaller images in their universal iPhone/iPad apps. I created a large test image and I tried scaling down (using cocos2d) by 0.46875. After viewing that in the iPhone 4.0 simulator I found the results were pretty crappy... rough pixel edges, etc. Plus, loading huge image files for iPhone users when they don't need them is pretty lame. So I guess what I will probably have to do is save out two versions of every sprite... large (for the iPad side) and small (for iPhone/iPod Touch) then detect the user's device and spit out the proper sprite like so: NSString *deviceType = [UIDevice currentDevice].model; CCSprite *test; if([deviceType isEqualToString:@"iPad"]) { test = [CCSprite spriteWithFile:@"testBigHuge.png"]; } else { test = [CCSprite spriteWithFile:@"testRegularMcTiny.png"]; } [self addChild: test]; How are you guys doing this? I'd rather avoid sprinkling all of my code with if statements like this. I want to also avoid using .xib files since it's an OpenGL-based app. Thanks!

    Read the article

  • make folder structure at device side in iphone

    - by Ekra
    Hi friends, I have a folder structure at server side. Inside the folders there are files of all format like .txt, .pdf. I get the structure in XML format. Now I want to create the same folder structure that is present in server side at my iphone documents folder with only the names of files inside it and not the content of the files. eg: folder1 1.text(it is inside folder1) folder2 2.pdf(it is inside folder2) folder3 subFolder3 (it is inside folder3) 3.txt (it is inside subFolder3) folder4 4.txt How I need to handle the overall approach. Any help would be highly appreciated. Waiting for your reply

    Read the article

  • how to create folder structure in documents folder of my iPhone app

    - by Ekra
    Hi friends, I have a folder structure in my server. I receive the folder structure in XML format. My query is :- 1) Can I create the same folder structure in documents folder of my iPhone app. 2) What would be the best approach whether to create folders at device documents folder or just read the XML and show the folders as we parse it(I mean no folder creation). Waiting for your reply

    Read the article

  • iphone - creating a reference to a MPMoviePlayerController

    - by Mike
    At some point in my code I am creating a MPMoviePlayerController object and playing it. As I need to reference this object at some other methods in my code that runs asynchronously, I need to store a pointer to the movie object etc., so I can use that. Declaring MPMoviePlayerController * myMovie on the header file is out of question, because the compiler will give me an error saying "expected specifier-qualifier-list before 'MPMoviePlayerController'". If it was a view I could do something like [self.view viewWithTag:99]; to get the object, but the MPMoviePlayerController does not allow this. How can I obtain the movie object or store a reference to it, so I can call the object in other methods? thanks for any help.

    Read the article

  • iPad: SplitView does not rotate

    - by raj.tiwari
    I have the following setup: A subclass of UISplitViewController that creates the master and detail view controllers in the constructor. Master and Detail view controllers that both override shouldAutorotateToInterfaceOrientation to return `YES'. Detail view controller implements the UISplitViewControllerDelegate protocol and deals with the popover. I am observing two weird issues that might be interrelated: When the split view comes up (in portrait mode - default on simulator), the Master view is visible. It should not be. When I rotate the simulator, the view does not "right" itself. My UISplitViewController subclass does not override shouldAutorotateToInterfaceOrientation. However, both master and details view controllers do and return YES. Any ideas what I might be doing wrong? Is this a simulator bug? Thanks. -Raj

    Read the article

  • iPhone App Shows a white light dot when the iphone is woke up from sleep mode

    - by Futur
    Hi All, I am not sure whether this is a strange case,but this is the scenario. I open my iPhone app in my iPhone device and i work on the app I Lock my iPhone device and I try to unlock the phone from sleep mode When the unlock is successful, I see a white light of size 3 to 4 pixels in the center of the screen and from that point the app resumes. What would be the reason for this error, kindly help.

    Read the article

  • iPhone: Can access files in documents directory in Simulator, but not device

    - by Kevin Cupp
    Hi there! I'm writing an app that copies some contents of the bundle into the applications Document's directory, mainly images and media. I then access this media throughout the app from the Document's directory. This works totally fine in the Simulator, but not on the device. The assets just come up as null. I've done NSLog's and the paths to the files look correct, and I've confirmed that the files exist in the directory by dumping a file listing in the console. Any ideas? Thank you! EDIT Here's the code that copies to the Document's directory NSString *pathToPublicationDirectory = [NSString stringWithFormat:@"install/%d",[[[manifest objectAtIndex:i] valueForKey:@"publicationID"] intValue]]; NSString *manifestPath = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"xml" inDirectory:pathToPublicationDirectory]; [self parsePublicationAt:manifestPath]; // Get actual bundle path to publication folder NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:pathToPublicationDirectory]; // Then build the destination path NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d", [[[manifest objectAtIndex:i] valueForKey:@"publicationID"] intValue]]]; NSError *error = nil; // If it already exists in the documents directory, delete it if ([fileManager fileExistsAtPath:destinationPath]) { [fileManager removeItemAtPath:destinationPath error:&error]; } // Copy publication folder to documents directory [fileManager copyItemAtPath:bundlePath toPath:destinationPath error:&error]; I am figuring out the path to the docs directory with this method: - (NSString *)applicationDocumentsDirectory { return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; } And here's an example of how I'm building a path to an image path = [NSString stringWithFormat:@"%@/%d/%@", [self applicationDocumentsDirectory], [[thisItem valueForKey:@"publicationID"] intValue], [thisItem valueForKey:@"coverImage"]];

    Read the article

  • iPhone / Objective-C: NSMutableArray writeToFile won't write to file. Always returns NO

    - by Joel
    I'm trying to serialize two NSMutableArrays of NSObjects that implement the NSCoding protocol. However it works for one (stacks) and not the other (cards). I have the following block of code: -(void) saveCards { NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; NSString* cardsFile = [documentsDirectory stringByAppendingPathComponent:@"cards.state"]; NSString* stacksFile = [documentsDirectory stringByAppendingPathComponent:@"stacks.state"]; BOOL c = [rootStack.cards writeToFile:cardsFile atomically:YES]; BOOL s = [rootStack.stacks writeToFile:stacksFile atomically:YES]; } I step through this method using the debugger, and after the last two lines of code run, I check the values of the two BOOLs. BOOL c is NO and BOOL s is YES. The stacks array is actually empty (which is probably why it works). The cards array has contents. Why is it that the array with contents is failing? I can't figure this out. I've looked through numerous threads on SOF, each of them say the problem is because the protection level of the files they were writing were preventing them from writing. This is not my problem, as I'm writing to the Documents folder. I've double and tripple checked that neither rootStack.cards nor rootStack.stacks is nil. And I've checked that cards does indeed have content. Here are the coder methods for my Notecard class (I added all the if statments as part of trying to solve this problem to make sure trying to encode nil values doesn't break something): -(void) encodeWithCoder:(NSCoder *)encoder { if(text) [encoder encodeObject:text forKey:@"text"]; if(backText) [encoder encodeObject:backText forKey:@"backText"]; if(x) [encoder encodeObject:x forKey:@"x"]; if(y) [encoder encodeObject:y forKey:@"y"]; if(width) [encoder encodeObject:width forKey:@"width"]; if(height) [encoder encodeObject:height forKey:@"height"]; if(timeCreated) [encoder encodeObject:timeCreated forKey:@"timeCreated"]; if(audioManagerTicket) [encoder encodeObject:audioManagerTicket forKey:@"audioManagerTicket"]; if(backgroundColor) [encoder encodeObject:backgroundColor forKey:@"backgroundColor"]; } -(id) initWithCoder:(NSCoder *)decoder { self = [super init]; if(!self) return nil; self.text = [decoder decodeObjectForKey:@"text"]; self.backText = [decoder decodeObjectForKey:@"backText"]; self.x = [decoder decodeObjectForKey:@"x"]; self.y = [decoder decodeObjectForKey:@"y"]; self.width = [decoder decodeObjectForKey:@"width"]; self.height = [decoder decodeObjectForKey:@"height"]; self.timeCreated = [decoder decodeObjectForKey:@"timeCreated"]; self.audioManagerTicket = [decoder decodeObjectForKey:@"audioManagerTicket"]; self.backgroundColor = [decoder decodeObjectForKey:@"backgroundColor"]; return self; } each field is either an NSString, NSNumber, or UIColor. Thanks for any help

    Read the article

  • iphone - UITapGestureRecognizer problem

    - by Mike
    I have two UIImageViews one as subview of the other. The subview is smaller and is centered on the screen. Both have UITapGestureRecognizer assigned and both were intended to respond to single taps. A single tap on the main view (= the area outside the subview) is fine, but a tap inside the subview is seen as the main view as a tap too. How can I have this to work independently? both views have setCancelsTouchesInView and setDelaysTouchesEnded set to NO and both have the same delegate (yes, I need to have the same delegate and cannot change that). How may I force the main view to ignore any tap on the area that belongs to its subview? thanks for any help.

    Read the article

  • Draw a Custom cell for tableview ( uitableview ) , with changed colors and separator color and width

    - by Madhup
    Hi, I want to draw the background of a UITableViewCell which has a grouped style. The problem with me is I am not able to call the -(void)drawRect:(CGRect)rect or I think it should be called programmatically... I have taken code from following link . http://stackoverflow.com/questions/400965/how-to-customize-the-background-border-colors-of-a-grouped-table-view/1031593#1031593 // // CustomCellBackgroundView.h // // Created by Mike Akers on 11/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> typedef enum { CustomCellBackgroundViewPositionTop, CustomCellBackgroundViewPositionMiddle, CustomCellBackgroundViewPositionBottom, CustomCellBackgroundViewPositionSingle } CustomCellBackgroundViewPosition; @interface CustomCellBackgroundView : UIView { UIColor *borderColor; UIColor *fillColor; CustomCellBackgroundViewPosition position; } @property(nonatomic, retain) UIColor *borderColor, *fillColor; @property(nonatomic) CustomCellBackgroundViewPosition position; @end // // CustomCellBackgroundView.m // // Created by Mike Akers on 11/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import "CustomCellBackgroundView.h" static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth,float ovalHeight); @implementation CustomCellBackgroundView @synthesize borderColor, fillColor, position; - (BOOL) isOpaque { return NO; } - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { // Drawing code CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(c, [fillColor CGColor]); CGContextSetStrokeColorWithColor(c, [borderColor CGColor]); CGContextSetLineWidth(c, 2.0); if (position == CustomCellBackgroundViewPositionTop) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny + 1; maxx = maxx - 1; maxy = maxy ; CGContextMoveToPoint(c, minx, maxy); CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, miny, maxx, maxy, ROUND_SIZE); CGContextAddLineToPoint(c, maxx, maxy); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionBottom) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny ; maxx = maxx - 1; maxy = maxy - 1; CGContextMoveToPoint(c, minx, miny); CGContextAddArcToPoint(c, minx, maxy, midx, maxy, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, maxy, maxx, miny, ROUND_SIZE); CGContextAddLineToPoint(c, maxx, miny); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionMiddle) { CGFloat minx = CGRectGetMinX(rect) , maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny ; maxx = maxx - 1; maxy = maxy ; CGContextMoveToPoint(c, minx, miny); CGContextAddLineToPoint(c, maxx, miny); CGContextAddLineToPoint(c, maxx, maxy); CGContextAddLineToPoint(c, minx, maxy); CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionSingle) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , midy = CGRectGetMidY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny + 1; maxx = maxx - 1; maxy = maxy - 1; CGContextMoveToPoint(c, minx, midy); CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, miny, maxx, midy, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, maxy, midx, maxy, ROUND_SIZE); CGContextAddArcToPoint(c, minx, maxy, minx, midy, ROUND_SIZE); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } } - (void)dealloc { [borderColor release]; [fillColor release]; [super dealloc]; } @end static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth,float ovalHeight) { float fw, fh; if (ovalWidth == 0 || ovalHeight == 0) {// 1 CGContextAddRect(context, rect); return; } CGContextSaveGState(context);// 2 CGContextTranslateCTM (context, CGRectGetMinX(rect),// 3 CGRectGetMinY(rect)); CGContextScaleCTM (context, ovalWidth, ovalHeight);// 4 fw = CGRectGetWidth (rect) / ovalWidth;// 5 fh = CGRectGetHeight (rect) / ovalHeight;// 6 CGContextMoveToPoint(context, fw, fh/2); // 7 CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1);// 8 CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1);// 9 CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1);// 10 CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); // 11 CGContextClosePath(context);// 12 CGContextRestoreGState(context);// 13 } but the problem is my drawRect is not getting called automatically......... I am doing it like this. CustomCellBackgroundView *custView = [[CustomCellBackgroundView alloc] initWithFrame:CGRectMake(0,0,320,44)]; [cell setBackgroundView:custView]; [custView release]; and doing this gives me transparent cell. I tried and fought with code but could get any results. Please help me out. I am really having no idea how this code will run.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >