[iphone] in app store - remembering a purchase

2009-10-29 Thread Dragos Ionel
excerpt from:

*Built-in Product
Model*http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Overview%20of%20the%20Store%20Kit%20API/OverviewoftheStoreKitAPI.html#//apple_ref/doc/uid/TP40008267-CH100-SW12
*

In the built-in product model, everything required to deliver products is
built in to your application. *
*,,,
After a product is successfully purchased, your application must unlock the
feature and deliver it to the user. The simplest way to unlock features is
by changing your Application Preferences. Application preferences are backed
up when users backs up their phones. **Your application may want to
recommend to users that they back up their phones after making a purchase to
ensure that purchases are not lost.*
*
*
*
*
Question:

Is it correct to assume that if a user buys an in app store item, but does
not back up his iphone, and deletes the application and reinstalls it, there
is no way for the app to know that the item was bought before?

If this is not correct, what would be the options available?

Thank you,
Dragos
iphodea.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


self release

2009-10-05 Thread Dragos Ionel
I have the following scenario:
A UIViewController, called BookViewController represents a book.

Another UIViewController, ChapterViewController, represents a chapter in the
book.

BookViewController initializes and displays one ChapterViewController, that
represents the current chapter that is read.

The user moves through the pages of the chapter, back and forth. This
functionality belongs to ChapterViewController.

When the last page of the chapter is reached and the user tries to get to
the next page, the code inside the ChapterViewController has somehow to tell
the parent controller, BookViewController that it needs to be released and
another chapter to be initialized.

How can this be achieved?

Your help is appreciated.
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and UIWebView load

2009-09-12 Thread Dragos Ionel
I still cannot figure this out, so any help would be kind appreciated.
I followed the debugging steps from
herehttp://www.corbinstreehouse.com/blog/index.php/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/and
here is what I obtained:

Code except:

.h file:
...

@interface DetailViewController : UIViewController UIWebViewDelegate

...

.m file:


- (void) webViewDidFinishLoad:(UIWebView *)sender {

NSLog(@Enter webViewDidFinishLoad);


 if(saveView==YES){

//add a new page to the scroll view

NSLog(@save view for page %d, crtPage);

 NSString* htmlTemplate = @htmlbodydiv align='justify'font
face='American Typewriter' color='black'
size='2'@text/font/div/body/html;

NSString * htmlContentTemp = [aChapter.content substringWithRange:
NSMakeRange(startPos,crtPos-startPos)];

htmlContentTemp = [htmlContentTemp stringByReplacingOccurrencesOfString:@~
withString:@br/nbsp;nbsp;];

htmlContentTemp = [htmlTemplate stringByReplacingOccurrencesOfString:
@@text withString:htmlContentTemp];

 UIWebView* newWebView = [[UIWebView alloc] initWithFrame:CGRectMake(5,5,310
,400)];

[newWebView loadHTMLString:htmlContentTemp baseURL:[NSURL URLWithString:@
]];

[scrollView addSubview:newWebView];

[newWebView release];

}

}


The log shows me that:

12/09/09 4:22:42 PM alice[1572] *** -[CFString _createSubstringWithRange:]:
message sent to deallocated instance *0x7495ac0*

that corresponds to:

# Category Event Type Timestamp Address Size Responsible Library Responsible
Caller
342 CFString CFRelease 00:20.347 *0x7495ac0* *0* UIKit *-[UIWebDocumentView
loadHTMLString:baseURL:*]



So making a long story short,

when I launch
*[newWebView **loadHTMLString**:htmlContentTemp **baseURL**:[**NSURL** **
URLWithString**:**@**]];*

the string *htmlContentTemp* gets deallocated before the *UIWebView* loaded
the content

Any suggestion how I can prevent that?

Thanks a lot,
Dragos



On Fri, Sep 11, 2009 at 10:10 PM, Andrew Farmer andf...@gmail.com wrote:

 On 11 Sep 2009, at 06:59, Dragos Ionel wrote:

 Is the following code supposed to run correctly?

 NSString* *htmlContent* = ...;// very long html content

 UIWebView* webView = [[UIWebView alloc] initWithFrame:...];

 [webView  loadHTMLString:*htmlContent* baseURL:...]; //assume this will
 take
 some time

 *htmlContent* = @different text;

 My question is if the memory space for *htmlContent* will be preserved
 until
 the webView finishes loading it, considering the fact that it will run in
 a
 different thread.


 Assigning a new value to a NSString * pointer does not mutate the original
 string.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSString and UIWebView load

2009-09-11 Thread Dragos Ionel
Is the following code supposed to run correctly?

NSString* *htmlContent* = ...;// very long html content

UIWebView* webView = [[UIWebView alloc] initWithFrame:...];

[webView  loadHTMLString:*htmlContent* baseURL:...]; //assume this will take
some time

*htmlContent* = @different text;


My question is if the memory space for *htmlContent* will be preserved until
the webView finishes loading it, considering the fact that it will run in a
different thread.

Thanks,
Dragos
iphodea.com http://www.iphodea.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UIWebView height calculation

2009-09-07 Thread Dragos Ionel
Hi,

1. I am trying to find how much text fits in a UIWebView of a certain
size (let's say 320x400).

For this, I am using a UIWebViewDelegate in the following way:

- (void)webViewDidFinishLoad:(UIWebView *)webView{
   //...
  CGSize size = [webView sizeThatFits:CGSizeZero];

  int h = size.height;

  if(h=maxHeight) {
    //add another character to the string htmlContent
    ...
  } else {
     //reached the maximum height, do nothing
     return;
  }

  [webView loadHTMLString:htmlContent baseURL:[NSURL URLWithString:@]];
}

Is it a good idea to call loadHTMLString from a delegate?

The delegate is supposed to run in a different thread than the main one


2. Is there a simpler way to find how much content can fit in a UIWebView?

Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[iphone] ebook

2009-09-03 Thread Dragos Ionel
Hi,
I am trying to build a book reader for iPhone.

If any of have any experience, can you please guide me?

For example

- should I use a UITextView or UIWebView?

- how can the page flip effect can be achieved?

No need to go to details, just direct me into the right direction.

Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[iphone] UIScrollView event handling

2009-08-26 Thread Dragos Ionel
Hi,
I have a UIVew that contains a UIScrollView.

UIScrollView is handling tap events, by moving the photos.

I would like to be able to handle swipe events in the UIView (the parent of
the scroll view).

Is it possible?

Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[iphone] displaying multiple images

2009-08-18 Thread Dragos Ionel
Is there any control that would allow to load multiple images at once and to
navigate from one to another by swipe gesture (in the same way one navigates
from one screen to another on the iPhone applications screens)?
Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iphone] split an image

2009-08-04 Thread Dragos Ionel
I am trying to create a puzzle from an image.

Divide the image in multiple parts, let's say 4x4=16, mix them and then ask
the user to move them back in the original spots.

Thanks,
Dragos


On Tue, Aug 4, 2009 at 4:26 PM, David Duncan david.dun...@apple.com wrote:

 On Aug 4, 2009, at 12:45 PM, Dragos Ionel wrote:

  Is there a simple way to split an image? For example, divide it in to 2x2
 = 4 pieces.

 Is UIImage the way to go?



 You somehow need to draw the image 4 times, but depending on what you are
 trying to do there are different approaches. Could you elaborate?
 --
 David Duncan
 Apple DTS Animation and Printing


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: something I can't understand

2009-07-29 Thread Dragos Ionel
verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value and then to
reassign to the button.

something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos


On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:

 Hi:
 Thank you for your reply.
 Oh yes. It an Objective-C class.

 regardless I place (bVerticalDisplay == YES) or not. The function silently
 fails, with no warnings.
 The I decided to
  pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
 This time I got warning.

 error: lvalue required as left operand of assignment

 Many thanks

 -Agha




 On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

  On 29/07/2009, at 12:52 PM, Agha Khan wrote:

  Hi:
 I have a struct
 @interface PngButton : UIButton
 {
 @public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
 }
 @property (assign) bool OffPos;
 @property (assign) CGPoint horizontalLoc;
 @property (assign) CGPoint verticalLoc;
 @end


 No, you have an Objective-C class.

  PngButton* pPngButton   = [PngButton
 buttonWithType:UIButtonTypeInfoDark];
 [pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0, 36,
 36)]; // No problem

 pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ? 250 :
 410, 50.0);

 I get an error
 error: lvalue required as left operand of assignment

 Why it is not working? I shouldn't get this error.
 Any help will be very much appreciated.


 Do you get any warnings?

 Try this and see what happens:
 pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ? 250.0 :
 410.0), 50.0);

 Kiel


 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/dragosionel%40gmail.com

 This email sent to dragosio...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: something I can't understand

2009-07-29 Thread Dragos Ionel
Actually it was my mistake as pointed by Glenn and Wagner.

My apologies to have misled.

Dragos
iphodea.com


On Wed, Jul 29, 2009 at 2:40 PM, Agha Khan agha.k...@me.com wrote:

 Hi Dragos lonal:I didn't mention they have readonly attributes. How can we
 remove readonly  attribute?

 Thanks for reply.

 Agha
 On Jul 29, 2009, at 6:35 AM, Dragos Ionel wrote:

 verticalLoc and x are readonly values, you cannot assign them.

 use the frame property, first to retrieve it, change the x value and then
 to reassign to the button.

 something like

 CGFrame frame = pPngButton.frame;
 frame.x = ...;
 pPngButton.frame = frame;

 Dragos


 On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:

 Hi:
 Thank you for your reply.
 Oh yes. It an Objective-C class.

 regardless I place (bVerticalDisplay == YES) or not. The function silently
 fails, with no warnings.
 The I decided to
  pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
 This time I got warning.

 error: lvalue required as left operand of assignment

 Many thanks

 -Agha




 On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

  On 29/07/2009, at 12:52 PM, Agha Khan wrote:

  Hi:
 I have a struct
 @interface PngButton : UIButton
 {
 @public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
 }
 @property (assign) bool OffPos;
 @property (assign) CGPoint horizontalLoc;
 @property (assign) CGPoint verticalLoc;
 @end


 No, you have an Objective-C class.

  PngButton* pPngButton   = [PngButton
 buttonWithType:UIButtonTypeInfoDark];
 [pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0, 36,
 36)]; // No problem

 pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ? 250 :
 410, 50.0);

 I get an error
 error: lvalue required as left operand of assignment

 Why it is not working? I shouldn't get this error.
 Any help will be very much appreciated.


 Do you get any warnings?

 Try this and see what happens:
 pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ? 250.0 :
 410.0), 50.0);

 Kiel


 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/dragosionel%40gmail.com

 This email sent to dragosio...@gmail.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Rotating image

2009-07-27 Thread Dragos Ionel
No need to release an image created using the imageNamed.

Dragos


On Sun, Jul 26, 2009 at 4:00 AM, Agha Khan agha.k...@me.com wrote:

 HI:
 I have an image which works fine.
 UIImage *img = [UIImage imageNamed:@background.png];
 [img drawAtPoint:CGPointMake(0,0)];
 [img release];

 Now suppose I want to rotate that image at 90 degree. Is there an easy way
 to accomplish this task?

 Best regards
 Agha

 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/dragosionel%40gmail.com

 This email sent to dragosio...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: memory allocation different in simulator and on the iPhone

2009-07-24 Thread Dragos Ionel
You are right, I was over releasing and maybe that was crashing the app.
But still, even without [image release] the memory used by the app on iPhone
is slowly increasing (like 3K for each image display). Maybe that is
supposed to happen , maybe something is cached somewhere.

But the good thing is it did not crash anymore after 200-300 images
displayed.

Thanks a lot,
Dragos


On Fri, Jul 24, 2009 at 3:14 AM, Jonathan del Strother 
maill...@steelskies.com wrote:

 UIImage* image = [UIImage imageNamed:fileName];
 UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
 [image release];

 You're overreleasing the image there.  You sure the phone is dying
 because it's out of memory, rather than because of that?

 On Fri, Jul 24, 2009 at 3:07 AM, Dragos Ioneldragosio...@gmail.com
 wrote:
  Hi,
  I am working on a animal encyclopedia on iPhone. One of the pages
 displays
  one photo of an animal. When the user swipes the screen the image is
  replaced with another one.
 
  This works fine and when tested in the simulator with the Instrument for
  Object Allocation, all looks cool.
 
  When I tested on the real iPhone with Instrument, the memory used
 increases
  slowly but constantly so that eventually the application dies.
 
  Here is the method that is doing the image changing (direction means if
 the
  new image should come from left or from right). The class is a
  UIViewController
 
 
  -(void) displayAnimal: (int) animaIndex fromDirection:(int)direction{
 
   crtIndex = animaIndex;
 
   NSString* animalName = [[animalList objectAtIndex:animaIndex]
 objectForKey:
  @name];
 
  NSString* fileName   = [[animalList objectAtIndex:animaIndex]
 objectForKey:
  @file];
 
   self.title = animalName;
 
   //remove all the subviews
 
  for (UIView *view in self.view.subviews) {
 
  [view removeFromSuperview];
 
  }
 
   UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,
 320,
  480)];
 
  backgroundView.backgroundColor = [UIColor blackColor];
 
  [self.view addSubview:backgroundView];
 
  [backgroundView release];
 
   UIImage* image = [UIImage imageNamed:fileName];
 
  UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
 
  [image release];
 
   CGRect imageFrame = imageView.frame;
 
  imageFrame.origin = CGPointMake(320*direction,0);
 
  imageView.frame = imageFrame;
 
   [self.view addSubview:imageView];
 
 
   [UIView beginAnimations: nil context: @identifier];
 
  [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
 
  [UIView setAnimationDuration:0.5];
 
   imageFrame.origin = CGPointMake(0,0);
 
  imageView.frame = imageFrame;
 
   [UIView commitAnimations];
 
  [imageView release];
 
  }
 
  Can you see anything that is not right? Why is the memory allocation
 showing
  different in simulator and on the iPhone?
 
  Thanks a lot,
  Dragos
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
 
 http://lists.apple.com/mailman/options/cocoa-dev/maillist%40steelskies.com
 
  This email sent to maill...@steelskies.com
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: memory allocation different in simulator and on the iPhone [solved]

2009-07-24 Thread Dragos Ionel
Dear all,
Thank you all for the feedback. With that help and few hours of digging I
was able to solve the problem.

Just for reference here is what I was doing wrong;

1.

UIImage* image = [UIImage imageNamed:fileName];

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

*[image **release**];*

If an image is created using imageNamed, then it is released automatically
so [image release] is incorrect;

2. At one point I was doing [titleLabel dealloc] for a UILabel instead of
[titleLabel release];


*How I discover where it was crashing*? I added NSLog in different part of
the code, run the application in simulator, and selected Hardware -
Simulate Memory Warning.


*How I got tricked?* I looked at memory allocation and after each
imagedNamed there was a huge increase. That made me think that I have to
release the image which is not correct. The imageNamed is caching the image,
but it is clearing the cache when need be.

Your help was much appreciated!

Dragos


On Thu, Jul 23, 2009 at 10:07 PM, Dragos Ionel dragosio...@gmail.comwrote:

 Hi,
 I am working on a animal encyclopedia on iPhone. One of the pages displays
 one photo of an animal. When the user swipes the screen the image is
 replaced with another one.

 This works fine and when tested in the simulator with the Instrument for
 Object Allocation, all looks cool.

 When I tested on the real iPhone with Instrument, the memory used increases
 slowly but constantly so that eventually the application dies.

 Here is the method that is doing the image changing (direction means if the
 new image should come from left or from right). The class is a
 UIViewController


 -(void) displayAnimal: (int) animaIndex fromDirection:(int)direction{

  crtIndex = animaIndex;

  NSString* animalName = [[animalList objectAtIndex:animaIndex]
 objectForKey:@name];

 NSString* fileName   = [[animalList objectAtIndex:animaIndex] objectForKey
 :@file];

  self.title = animalName;

  //remove all the subviews

 for (UIView *view in self.view.subviews) {

 [view removeFromSuperview];

 }

  UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,
 320, 480)];

 backgroundView.backgroundColor = [UIColor blackColor];

 [self.view addSubview:backgroundView];

 [backgroundView release];

  UIImage* image = [UIImage imageNamed:fileName];

 UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

 [image release];

  CGRect imageFrame = imageView.frame;

 imageFrame.origin = CGPointMake(320*direction,0);

 imageView.frame = imageFrame;

  [self.view addSubview:imageView];


  [UIView beginAnimations: nil context: @identifier];

 [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];

 [UIView setAnimationDuration:0.5];

  imageFrame.origin = CGPointMake(0,0);

 imageView.frame = imageFrame;

  [UIView commitAnimations];

 [imageView release];

 }

 Can you see anything that is not right? Why is the memory allocation
 showing different in simulator and on the iPhone?

 Thanks a lot,
 Dragos

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


memory allocation different in simulator and on the iPhone

2009-07-23 Thread Dragos Ionel
Hi,
I am working on a animal encyclopedia on iPhone. One of the pages displays
one photo of an animal. When the user swipes the screen the image is
replaced with another one.

This works fine and when tested in the simulator with the Instrument for
Object Allocation, all looks cool.

When I tested on the real iPhone with Instrument, the memory used increases
slowly but constantly so that eventually the application dies.

Here is the method that is doing the image changing (direction means if the
new image should come from left or from right). The class is a
UIViewController


-(void) displayAnimal: (int) animaIndex fromDirection:(int)direction{

 crtIndex = animaIndex;

 NSString* animalName = [[animalList objectAtIndex:animaIndex] objectForKey:
@name];

NSString* fileName   = [[animalList objectAtIndex:animaIndex] objectForKey:
@file];

 self.title = animalName;

 //remove all the subviews

for (UIView *view in self.view.subviews) {

[view removeFromSuperview];

}

 UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320,
480)];

backgroundView.backgroundColor = [UIColor blackColor];

[self.view addSubview:backgroundView];

[backgroundView release];

 UIImage* image = [UIImage imageNamed:fileName];

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

[image release];

 CGRect imageFrame = imageView.frame;

imageFrame.origin = CGPointMake(320*direction,0);

imageView.frame = imageFrame;

 [self.view addSubview:imageView];


 [UIView beginAnimations: nil context: @identifier];

[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];

[UIView setAnimationDuration:0.5];

 imageFrame.origin = CGPointMake(0,0);

imageView.frame = imageFrame;

 [UIView commitAnimations];

[imageView release];

}

Can you see anything that is not right? Why is the memory allocation showing
different in simulator and on the iPhone?

Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


link a web page from a view

2009-07-08 Thread Dragos Ionel
I am working on a simple iPhone application.
One page contains a UIView with some information and a link to a website.

What controls should I use so that when the user taps the link, the
application to stop and the browser application to load the website.

Thank you,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com