Search Results

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

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

  • Reducing lag when downloading large amount of data from webpage

    - by Mahir
    I am getting data via RSS feeds and displaying each article in a table view cell. Each cell has an image view, set to a default image. If the page has an image, the image is to be replaced with the image from the article. As of now, each cell downloads the source code from the web page, causing the app to lag when I push the view controller and when I try scrolling. Here is what I have in the cellForRowAtIndexPath: method. NSString * storyLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"]; storyLink = [storyLink stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *sourceCode = [NSString stringWithContentsOfURL:[NSURL URLWithString:storyLink] encoding:NSUTF8StringEncoding error:&error]; NSString *startPt = @"instant-gallery"; NSString *startPt2 = @"<img src=\""; if ([sourceCode rangeOfString:startPt].length != 0) { //webpage has images // find the first "<img src=...>" tag starting from "instant-gallery" NSString *trimmedSource = [sourceCode substringFromIndex:NSMaxRange([sourceCode rangeOfString:startPt])]; trimmedSource = [trimmedSource substringFromIndex:NSMaxRange([trimmedSource rangeOfString:startPt2])]; trimmedSource = [trimmedSource substringToIndex:[trimmedSource rangeOfString:@"\""].location]; NSURL *url = [NSURL URLWithString:trimmedSource]; NSData *data = [NSData dataWithContentsOfURL:url]; UIImage *image = [UIImage imageWithData:data]; cell.picture.image = image; Someone suggested using NSOperationQueue. Would this way be a good solution? EDIT: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"FeedCell"; LMU_LAL_FeedCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"LMU_LAL_FeedCell" owner:self options:nil]; cell = (LMU_LAL_FeedCell*) [nib objectAtIndex:0]; } int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; NSString *untrimmedTitle = [[stories objectAtIndex: storyIndex] objectForKey: @"title"]; cell.title.text = [untrimmedTitle stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; CGSize maximumLabelSize = CGSizeMake(205,9999); CGSize expectedLabelSize = [cell.title.text sizeWithFont:cell.title.font constrainedToSize:maximumLabelSize]; //adjust the label to the the new height. CGRect newFrame = cell.title.frame; newFrame.size.height = expectedLabelSize.height; cell.title.frame = newFrame; //position frame of date label CGRect dateNewFrame = cell.date.frame; dateNewFrame.origin.y = cell.title.frame.origin.y + cell.title.frame.size.height + 1; cell.date.frame = dateNewFrame; cell.date.text = [self formatDateAtIndex:storyIndex]; dispatch_queue_t someQueue = dispatch_queue_create("cell background queue", NULL); dispatch_async(someQueue, ^(void){ NSError *error = nil; NSString * storyLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"]; storyLink = [storyLink stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *sourceCode = [NSString stringWithContentsOfURL:[NSURL URLWithString:storyLink] encoding:NSUTF8StringEncoding error:&error]; NSString *startPt = @"instant-gallery"; NSString *startPt2 = @"<img src=\""; if ([sourceCode rangeOfString:startPt].length != 0) { //webpage has images // find the first "<img src=...>" tag starting from "instant-gallery" NSString *trimmedSource = [sourceCode substringFromIndex:NSMaxRange([sourceCode rangeOfString:startPt])]; trimmedSource = [trimmedSource substringFromIndex:NSMaxRange([trimmedSource rangeOfString:startPt2])]; trimmedSource = [trimmedSource substringToIndex:[trimmedSource rangeOfString:@"\""].location]; NSURL *url = [NSURL URLWithString:trimmedSource]; NSData *data = [NSData dataWithContentsOfURL:url]; UIImage *image = [UIImage imageWithData:data]; dispatch_async(dispatch_get_main_queue(), ^(void){ cell.picture.image = image; }); }) //error: expected expression } return cell; //error: expected identifier } //error extraneous closing brace

    Read the article

  • didSelectRowAtIndexPath being called after viewDidLoad of the called view

    - by Serguei Fedorov
    I am trying to pass variables over to the new view. I have the following code: appDelegate *dataCenter = (AppDelegate*)[[UIApplication sharedApplication] delegate]; dataCenter.myVariable = [array objectAtIndex:indexPath.row]; in the didSelectRowAtIndexPath of the calling view. However, the issue that I have is that this variable is empty in the vewDidLoad function of the next view, simply because it fired off BEFORE the didSelectRowAtIndexPath of the calling view. I am using storyboard to link the views together. Both are UITableView. If I hit back and then reselect the table element it is then set, granted that by the time I hit back and then selected again, the variable got set. Is there any way to for the order of execution? I really don't want to do UI view switching on the back end. Any help is greatly appreciated!

    Read the article

  • NSUserDefaults with in-app Settings bundle

    - by Hema Vasudevan
    I'm in the process of building an app and would prefer to have an in-app specific Settings bundle rather than make it available in the Settings application. I'm using NSUserDefaults class to save and retrieve them but would like to have the same Settings app look and feel. I wanted to use InAppSettingsKit or the llamasettings but don't know how to use the NSUserDefaults class. Those kits tell me how to create a .plist file and use their kits. All I need is use the Settings app look and feel while at the same time use NSUserDefaults class to save and retrieve values. Please help.

    Read the article

  • Javascript on mobile os, android and ipad

    - by albanx
    Hello I am trying to do a javascript function compatible on android and ipad, but i notice that android doesnt support ongesture** events? 1.It's really true? .ongesturestart=function(e){ .ongesturechange=function(e){ .ongestureend=function(e){ 2.Since I cant buy niether an Android system nor a Ipad, is there any Android/Ipad simulator for pc/windows/linux around the web? I need them for developenig and simulating web application based on touch/gestures events. 3.Is there possible that google hasnt develop chrome for android platform? and firefox for android/Ipad? Thanks

    Read the article

  • Breaking One Big Graphic of MutablePaths into CAShapeLayers

    - by StackOverFlowRider
    I have a class called GraphicView that takes a Graphic object and draws it in its drawRect method. This Graphic object is basically an array of mutablePaths that comprise an icon that I want drawn. For performance and other issues, I was thinking of taking this icon that is comprised of mutablePaths, and dividing it into a bunch of CAShapeLayers. I'm wondering is this possible? Considering the points for the mutablePaths of the icon are all interwoven together (ie the icon was initially an SVG file that I converted to code), is it possible to divide different parts of the icon into CAShapeLayers, and reassemble them all together when assigning to the views layer? If so how would it be done? If I assign them as sublayers to a CALayer or CAShapeLayer, will it understand to mesh them all together?

    Read the article

  • Show a SplashScreenScene before to GameScene?

    - by lisovaccaro
    I want to add a splash screen to my game. I created a SplashScene.sks and a SplashScene.swift file. I'm trying to load my SplashScene before GameScene but I cannot manage to do it. How should I do this? This is what I'm trying now: class GameViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let skView = self.view as SKView skView.ignoresSiblingOrder = true /* Set the scale mode to scale to fit the window */ var scene = SplashScreenScene() // Present SplashScreenScene first scene.scaleMode = .AspectFill skView.presentScene(scene) } Then on my SplashScreenScene: class SplashScreenScene: SKScene { override func didMoveToView(view: SKView) { self.size = view.bounds.size self.anchorPoint = CGPointMake(0.5, 0.5) var background = SKSpriteNode(imageNamed:"LaunchImage") self.addChild(background) // Start timer to load next scene NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("changeScene"), userInfo: nil, repeats: false) } func changeScene() { let scene = GameScene() view.presentScene(scene) } } This is very close to the solution, however for some reason when I do this my game becomes laggy (if I present GameScene directly the game runs fine).

    Read the article

  • iPhone Accelerometer Values

    - by Mike
    My question is about the iPhone accelerometer. Does the accelerometer measure acceleration or movement of the iPhone? What I mean is if I hold the iPhone and go from 0mph to 60mph, I would expect the measure of acceleration to increase in value from 0 to 60, but once I reach 60, I expect the value to return to 0 since I am "no longer accelerating" but am moving at a constant speed. Now if the accelerometer measure motion, I would expect it to register 0 to 60 and continue to provide a change in value as I move forward at 60mph. Sorry, I looked at a few books, programmed some code (values seemed to small to give a recognizable result over short distances or speeds), and a lot of web searches, and I am trying to get an answer to this question. Thanx!

    Read the article

  • UITableView overlaps with NavigationBar in Storyboard Setting on first run

    - by Evils
    I know this seems to be a duplicate question which has been around here many many times, but believe me, I tried all iOS7 and earlier fixes which sets the Layout to a different Edge configuration without any change. My Storyboard looks like this: -> Navigation Controller -> Tab Bar Controller -> MyTableViewController -> VCForCellOne With the first run of my application the UITableView overlaps with the source NavigationController as shown here: After clicking on one of my Cells which pushes the corresponding ViewController to the NavigationController and going back again, everything looks fine as shown here: So everything is as it should be after once pushing another ViewController to the NavigationController and then going back. Switching from Portrait to Landscape and back also fixes the layout problem and everything is layed out as it should be. My ViewController within the Storyboard looks like this: I left it the default value, so I don't know what goes wrong here. I hope you understand my problem here. There's no custom class ViewController here, so no additional code which messes up something here. Any help highly appreciated!

    Read the article

  • NSURLSession has NSoperationqueue internally?

    - by JeffWood
    A)If NSURLSession runs task in background in iOS7,Has Apple integrated internally Queue in NSURLSession?How it works in secondary thread and also in App suspended Mode? B)What is the difference between NSURLSession and NSoperationqueue? C)If NSURLSession is the replacement of NSURLCOnnection, Can we integrate NSURLSession into NSOPerationqueue? D)Are both same? E)Can we do the same thing in NSURLSession as in NSoperationQueue? If NSURLSession is the relplacement of NSUrlconnection ,Which one is the best in all situations?What is the future of NSUrlconnection?

    Read the article

  • Runtime error on Did End On Exit in iPhone application

    - by Deepak Pillai
    Does anyone know why im getting runtime error when i click on return button on iphone keyboard. I need to hide keyboard after done editing values to UITextField. So i assigned Did End On Exit to IBAction and the IBAction code below -(IBAction)FinishEditing:(id)sender { [folderName resignFirstResponder]; } When running ma project i facing a runtime error and the variable values shown below argv char ** 0xbffff58c *argv char * 0xbffff6b8 **argv char '/' Console Value (lldb) Any idea to overcome this issue??

    Read the article

  • Change Interval Of CADisplayLink

    - by user3679109
    I have replaced an NSTimer with a CADisplayLink. I have it working properly but it is running too slowly. How could I go about speeding this up? This is the code that I'm using: ViewController.h (In {} with @interface: CADisplayLink *displayLink; ViewController.m (viewDidLoad): displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onTimer)]; [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; onTimer is the method that it is calling. So my question is how do I speed up how often this is being called? Thanks

    Read the article

  • UIImage in UIView and display image parts out of bounds

    - by Mpampinos Holmens
    I have an image in a subview that is bigger than the subview it self, is it possible to display parts of the image that are out of the subview! have tried the view.clipsToBounds=NO; but no lack still. here is part of my code so far. xRayView = [[XRayView alloc] initWithFrame: CGRectMake((1024 - 800) / 2, self.device.frame.origin.y - 26, 800,530)]; xRayView.clipsToBounds=NO; [xRayView setForgroundImage: [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"xray_foreground_01" ofType: @"png"]]]; [xRayView setBackgroundImage: [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"xray_background_01" ofType: @"png"]]]; the foreground and the background images are bigger than the xray view

    Read the article

  • ViewController Navigating

    - by Kobe.o4
    I have 4 ViewControllers, startViewController as the initial View Controller. This contains my intro. After its finish, it will [self presentViewController:vc animated:YES completion:NULL]; into my menuViewController. startViewController ------> menuViewController ------> C1ViewController \ \ ------> ImportantViewController In my menuViewController are buttons for the two ViewController like the above illustration. Also I presented them in the View with this: [self presentViewController:vc animated:YES completion:NULL]; I return tomenuViewController with this [self dismissModalViewControllerAnimated:YES]; What I wanted is to make the ImportantViewController to be the like the parent view or the mainVIew even if I go to other Views. What I need is when ImportantViewController is presented when I go to either C1ViewController or menuViewController it wont be deallocated, or its content there will still be retained. Is it possible? And How? I don't know much about what parent and child view controllers for so I dont know what to implement in my problem. Thank you. BTW, Im using Storyboard.

    Read the article

  • Different icons and title for same iPad application

    - by trapo
    I'm developing an iPad application that will be distributed "in-house" ie only inside enterprise. They asked me if i can produce 2 different releases of the same application to be installed on the same iPad. The first one will communicate with a production server while the second will use a sandbox server and will be used by user to learn the system. Server url will be changed in app settings. They told me to differentiate these releases by icon and title (and also, of course, by title in navigation bar). What's the best way to get this goal avoiding duplication of the project?

    Read the article

  • Access static Method in GDB

    - by Besi
    I recently discovered the GDB in Xcode which makes up for some functionality which IMHO seems to be lacking in Xcode. So I can do the following in GDB: (gdb) po [LoginManager sharedSession].loginToken 20D52FE9-3573-437E-9A65-846572B63726 However, I have another Service class, which is currently not loaded so I get the following error: (gdb) po [SessionService displaySessionInfoForToken:@"XXX"] No symbol "SessionService" in current context. I don't understand why the LoginManager can be loaded but not the SessionService.

    Read the article

  • adding a UITableView programmatically to a UIViewController

    - by Adam
    I'm loading a UIViewController into one of my Nav controller's hierarchies, which will contain some text and some images. At the bottom, I will want to create a expandable and collapsable tableview. First off, is this idea possible? If it is, how do I add it and where do I place the data source and delegate methods? Can I just make a separate subclass of the TableViewController and then add it to my ViewController as a subview?

    Read the article

  • viewForHeaderInSection - create header that would display properly in all cases

    - by sha
    I have an interesting problem/question and i'm not sure if it is even doable. So I have a custom header view for regular UITableView. But it's transparent and it doesn't fill fill table width. So it displayed properly when table is scrolled and this header view is displayed above cell content (sticked to the top). But when same header is displayed between two sections down - it looks ugly, because it's transparent and it's either displayed above black rectangle or above table background. I was wondering is there way to customize header view for when it's stick to the top and when it's not. Or... may be it's possible to specify what needs to be displayed underneath header view when it's between sections. Something like sectionSeparatorView?

    Read the article

  • What is the most efficient way to use Core Data?

    - by Eric
    I'm developing an iPad application using Core Data, and was hoping someone could clarify something about Core Data. Right now, I populate my table by making a fetch request for all of my data in viewDidLoad. I'd rather make individual fetch requests in my tableView:cellForRowAtIndexPath:. Can anyone tell me which is more efficient, and why? In other words, is it much less efficient to make lots of small requests as opposed to one big request?

    Read the article

  • what is the required code method of making a sticker app?

    - by zeropt7
    I am new to photo apps, recently I am interested in making a sticker app like those can be seen in the appstore, I know I would need to use uiimagepickercontroller, uiscrollview and uigesturerecognizer. However I wonder which code method should I use for the app to load multiple stickers? Should it be called programmatically? Is that I would need to use the if-statement, say if one sticker is loaded, the app will auto generate a new sticker on top of it?

    Read the article

  • Navigation Bar color doesn't change back? iOS7

    - by TKP
    I have several tableviews with navigation controller. The navigation bar is white for all the views except the last one, which is red. I have [[[self navigationController] navigationBar] setTintColor:[UIColor redColor]; in the viewDidLoad of the last tableview and [[[self navigationController] navigationBar] setTintColor:[UIColor whiteColor]; in the viewDidLoad of other table views. It works fine until I get to the last view and the color of the navigation bar changes to red. When I go back to the previous views, all the previous views' navigation bar has changed to red. Where should I put those codes so the color will remain unchanged? Thanks,

    Read the article

  • UIImage for UIImageView is nil

    - by yeesterbunny
    I'm having problem displaying UIImage in UIImageView. I looked all over stackoverflow for similar questions, but none of the fixes helped me. The image is indeed in my bundle File Inspector - Target Membership is checked for the image IBOutlet is connected (I have tried both using IBOutlet and doing it programmatically) Both png nor jpg works Here's the code for using Interface Builder - //@property and @synthesize set for IBOutlet UIImageView *imageView - (void)viewDidLoad { [super viewDidLoad]; NSAssert(self.imageView, @"self.imageView is nil. Check your IBOutlet connection"); UIImage *image = [UIImage imageNamed:@"banner.jpg"]; NSAssert(image, @"image is nil"); self.imageView.image = image; } This code will terminate with NSAssert, printing in the console that 'image is nil'. I also tried selecting the Image directly from the attributes inspector: However it still doesn't show the image (still terminates with NSAssert - 'image is nil'). Any help or suggestions will be greatly appreciated. Thanks

    Read the article

  • Frame sizing of tableview within nested child controllers/subviews

    - by jwoww
    I'm a bit confused by the proper frame sizing of a table view to fit within my screen. Here's my setup of view controllers within view controllers: UITabBarController UINavigationController as one of the tab bar viewcontrollers; title bar hidden ViewController - a container view controller because I need the option to place some controls beneath the UITableView, sometimes (but not in the current scenario) UITableViewController Now, my question is what the proper frame dimensions of the UITableview should be. Here's what I've got in the ViewController viewDidLoad method. I used subtracted 49.0 (the size of the tab bar) from 480.0. However, this leaves a black bar at the bottom. 20.0 appears to do it (coincidentally?) the size of the status bar, but I don't understand why that would be. Wouldn't the true pixel dimensions of the tableview be 480-49? // MessageTableViewController is my subclass of UITableViewController MessagesTableViewController *vcMessagesTable = [[MessagesTableViewController alloc] init]; CGRect tableViewFrame = CGRectMake(0, 0, 320.0, 480.0 - 49.0); [[vcMessagesTable view] setFrame:tableViewFrame]; self.tableViewController = vcMessagesTable; [self addChildViewController:vcMessagesTable]; [[self view] addSubview:vcMessagesTable.view]; Here's how it looks:

    Read the article

  • modifying constants in objective c during run time

    - by moshikafya
    I am trying to solve the following problem. I have the following constants in my header file: #define PREFS_MY_CONSTANT_1 @"bla1" #define PREFS_MY_CONSTANT_2 @"bla2" #define PREFS_MY_CONSTANT_3 @"bla3" ... In one of my functions, I'd like to print to the UIbutton one of those strings based on user input, so say the user inputs '1', i would show bla1. Instead of creating a huge switch (i have 100 of those), I am looking for a way to combine the constant with the variable holding the user input, so something like that ideally: NSInteger input; [button setTitle:PREFS_MY_CONSTANT_{$input} forState: UIControlStateNormal]; Is something like that possible? what would be the best way to solve this?

    Read the article

  • Objective-C Result from a Static Method saved to class instance variable giving "EXC_BAD_ACCESS" when used.

    - by KinGBin
    I am trying to store the md5 string as a class instance variable instead of the actual password. I have a static function that will return a md5 string which I'm trying to store in an instance variable instead of the actual password. I have the following setter for my class instance variable: -(void)setPassword:(NSString *)newpass{ if(newpass != password){ password = [utils md5HexDigest:newpass]; } } This will pass back the correct md5 string and save it to the password variable in my init function: [self setPassword:pword];. If I call another instance method and try to access self.password" I will get "EXC_BAD_ACCESS". I understand that the memory is getting released, but I have no clue to make sure it stays. I have tried alloc init with autorelease with no luck. This is the md5HexDigest function getting called during the init (graciously found in another stackoverflow question): + (NSString*)md5HexDigest:(NSString*)input { const char* str = [input UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5(str, strlen(str), result); NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2]; for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) { [ret appendFormat:@"%02x",result[i]]; } return ret; } Any help/pointers would be greatly appreciated. I would rather have the md5 string saved in memory than the actual password calling the md5 every time I needed to use the password. Thanks in advance.

    Read the article

  • How to implement action in didSelectRowAtIndexPath of UITableview?

    - by Sumana Mehta
    On my view, I used to have few buttons and each button had an action associated with it. UIButton *testButton = [[UIButton alloc] initWithFrame:CGRectMake(120,300,90,90)]; [testButton setBackgroundImage:[UIImage imageNamed:@"test.jpg"] forState:UIControlStateNormal]; [testButton addTarget:self.view action:@selector(gotoProd:) forControlEvents:UIControlEventTouchUpInside]; [testButton addt [scrollView testButton]; But now I am trying to replace all those buttons with the tableview with rows. I was able to populate the rows and I know one needs to use didSelectRowAtIndexPath for handling on select event of the cell. But how can I implement action:@selector(gotoProd:) in tableviews ?? Any help will be greatly appreciated.

    Read the article

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