Re: UIBarButtonItem exclusive touch

2011-08-30 Thread Leon Qiao
Hi,

Thanks for your response !
I missed something.In the thread method saveTheData, I do call the
popToRootViewController on the main thread by using
performSelectorOnMainThread:.

It seems that both of the two functions(saveAction: and tableView's delegate
method) are invoked. And the navigation controller first pop all view
controllers to the root. And then push the detail view controller, and
sometimes it push to the detail view and then pop to the root. So is there
any tips about the synchronization?

Thanks again!



2011/8/30 Conrad Shultz con...@synthetiqsolutions.com

 Sorry, I don't have time right now to fully respond, but first thing's
 first: UIKit is generally not thread-safe, so you should not invoke user
 interface actions (like popping a nav controller) on a secondary thread.

 This is a situation where GCD can make your life a lot simpler (with nested
 dispatch_async() calls)...

 (Sent from my iPhone.)

 --
 Conrad Shultz
 www.synthetiqsolutions.com

 On Aug 29, 2011, at 19:34, Leon Qiao leon.qiao@gmail.com wrote:

  Dear all,
 
  The UI I made is like the system app Contact, there's an add bar
 button
  on the navigation bar. And a table view where you can tap and enter the
  detail view. The problem is when the user tap the bar button item and the
  table view cell at the same time, it doesn't work well.
 
  The code here:
 
  Action for right bar button item:
  - (IBAction)saveAction: (id)sender;
  {
  ...
  ...
   [NSThread detachNewThreadSelector:@selector(saveTheData)
 toTarget:self
  withObject:nil];
  }
 
  - (void)saveTheData
  {
  //some save action...
  [self.navigationController popToRootViewControllerAnimated: YES];
  //when complete, pop to the root
  }
 
  Action for table view's delegate method
 
  - (void)tableView:(UITableView *)tableView
  didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  DetailViewController *controller = [[DetailViewController
 alloc]init];
  [self.navigationController pushViewController: controller animated:
  YES];
  [controller release];
  }
 
  When using UIButton, we can set the exclusive touch property to avoid
  tapping the two buttons at the same time. But what should I do for the
 table
  view and the bar button item.
 
  Thanks a lot!
 
  Best regards
  Leon
  ___
 
  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/conrad%40synthetiqsolutions.com
 
  This email sent to con...@synthetiqsolutions.com




-- 
Best regards
Leon
___

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


Thumbnail view like iPhone Photos app

2011-05-17 Thread Leon Qiao
Dear all,

I used to ask one question about NSCache. Actually, I need to build a view
like the 'Photos' application.
Now it works, but need to be improved: the speed of dragging, loading images
is not good enough.
Please give me some general ideas on how to load images on time and manage
the cached memory.

Thanks!

-- 
Best regards
Leon
___

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


How to use the NSCache

2011-05-15 Thread Leon Qiao
Dear all,

Have you ever used the NSCache? I'm a little confused on how to use it. I
want to make a list to hold some images in memory.
And the memory overload is a big problem. So I wish I could use the NSCache
to
manage the memory.
Please send me a demo or code fragment if you have.

Thanks a lot!

Best regards
Leon
___

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


iOS rotate to interface orientation problem

2011-04-18 Thread Leon Qiao
Dear all,

Recently, I need to do the following:
1. add a sub view of a view controller onto the window.
2. Make it fit the bottom of the window. That is, the bottom side of the
view and the bottom of the window will
coincide.
3. When the device rotated, the height of the subview will not be changed,
but I need to change the width, so
that it will fit the width of the window(for iPad, 1024 or 768 pixels).

But it feels like the old understanding of the rotate user interface
orientation is not correct. Would you please tell me
where is the right place that I should put the modification frame code. For
some reason, I don't want to use the auto-resizing mask here. Should I put
it into the didRotateFromInterfaceOrientation or
willRotateToInterfaceOrientation, or
willAnimateRotateToInterfaceOrientation method, and how should I do it?
Should I consider the transform of its super view?

Thanks a lot!

-- 
Best regards
Leon
___

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: iOS rotate to interface orientation problem

2011-04-18 Thread Leon Qiao
Hi Evadne,

Thanks for your reply! I tried the
willAnimateRotationToInterfaceOrientation:duration: as you mentioned. And
so far, so good.

Best regards
Leon

2011/4/18 Evadne Wu e...@monoceroi.com

 For not using autoresizing masks, is it that you don’t want to use
 them (theological reasons) or you can’t (pragmatic reasons)?

 Please just use them if possible, will save lots of wasted hours
 wrestling the frameworks.  Don’t fight the frameworks :)

 Otherwise, try willAnimateRotationToInterfaceOrientation:duration:, I
 find it extremely helpful.

 Please don’t think about getting the transform; needing it is
 *usually* a very bad thing meaning that something is wrong either at
 the framework level (unlikely) or at app level (more likely, almost
 all the time).

 -ev

 On Mon, Apr 18, 2011 at 7:30 PM, Leon Qiao leon.qiao@gmail.com
 wrote:
  Dear all,
 
  Recently, I need to do the following:
  1. add a sub view of a view controller onto the window.
  2. Make it fit the bottom of the window. That is, the bottom side of the
  view and the bottom of the window will
  coincide.
  3. When the device rotated, the height of the subview will not be
 changed,
  but I need to change the width, so
  that it will fit the width of the window(for iPad, 1024 or 768 pixels).
 
  But it feels like the old understanding of the rotate user interface
  orientation is not correct. Would you please tell me
  where is the right place that I should put the modification frame code.
 For
  some reason, I don't want to use the auto-resizing mask here. Should I
 put
  it into the didRotateFromInterfaceOrientation or
  willRotateToInterfaceOrientation, or
  willAnimateRotateToInterfaceOrientation method, and how should I do it?
  Should I consider the transform of its super view?
 
  Thanks a lot!
 
  --
  Best regards
  Leon
  ___
 
  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/ev%40monoceroi.com
 
  This email sent to e...@monoceroi.com
 




-- 
Best regards
Leon
___

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


On NSClassFromString method

2011-02-24 Thread Leon Qiao
Dear all,

I got a problem when using the NSClassFromString method to get a class.
The code is used in the google docs library. It failed to get the Class
object, the return value is 0x0.
But I already linked the library, and it works fine when using the class
itself directly.
Anyone who met the same problem, please help me. Thanks!

-- 
Best regards
Leon
___

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: On NSClassFromString method

2011-02-24 Thread Leon Qiao
Hi Dan,

Thanks a lot for your reply. I added the -Objc linker flag. And now it works
well.

Thanks and best regards
Leon

2011/2/25 Dan Treiman dtrei...@mac.com

 You can fix this by adding the -ObjC linker flag.  See related issue:
 http://developer.apple.com/library/mac/#qa/qa2006/qa1490.html
 This will force the linker to load classes from the static library


 Another way is to reference the class directly somewhere in the code such
 that it has no effect, i.e.
 [ClassINeed class];


 -Dan Treiman

 On Feb 24, 2011, at 9:19 PM, Leon Qiao wrote:

 Dear all,

 I got a problem when using the NSClassFromString method to get a class.
 The code is used in the google docs library. It failed to get the Class
 object, the return value is 0x0.
 But I already linked the library, and it works fine when using the class
 itself directly.
 Anyone who met the same problem, please help me. Thanks!

 --
 Best regards
 Leon
 ___

 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/dtreiman%40mac.com

 This email sent to dtrei...@mac.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: Image preview with UIWebView

2011-01-26 Thread Leon Qiao
Hi Kyle,

Thanks for your advise. I found the UIImage really wraps something that can
be used to read the raw image file. Maybe I need to check the file extension
and provide a UIImageView.



2011/1/26 Kyle Sluder kyle.slu...@gmail.com

 On Tue, Jan 25, 2011 at 10:05 PM, Leon Qiao leon.qiao@gmail.com
 wrote:
  I plan to use the UIWebView to display the preview of some image files.
  It works well when opening the common files. But it seems some special
  formats (such as CRW, Canon Camera Raw file) are not supported. It can
 be
  viewed via the QLPreviewController. Is there any better way to do the
 file
  preview function?

 Sounds like you're not going to be able to use a UIWebView for your
 preview.

 ImageIO can read Canon RAW images. Create a CGImageSource with the
 file's URL and you'll be able to get a CGImage out of it. You can then
 wrap it in a UIImageView and display it in a preview UI, or otherwise
 use it as you would any other CGImage.

 --Kyle Sluder




-- 
Best regards
Leon
___

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


Image preview with UIWebView

2011-01-25 Thread Leon Qiao
Dear all,

I plan to use the UIWebView to display the preview of some image files.
It works well when opening the common files. But it seems some special
formats (such as CRW, Canon Camera Raw file) are not supported. It can be
viewed via the QLPreviewController. Is there any better way to do the file
preview function?

Thanks.

-- 
Best regards
Leon
___

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


Tap to focus on iOS 4

2010-11-23 Thread Leon Qiao
Dear all,

I tried to add overlay view on the UIImagePickerController. Now it works,
but it seems I can't use the tap-to-focus feature any more. Can anyone help?

Thanks!

-- 
Best regards
Leon
___

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: iPad frame-by-frame animation

2010-11-04 Thread Leon Qiao
Dear David,

Thanks a lot for your feedback!
I need to put the animation on the other views with alpha info. So I don't
know if I can use the movie.
And the second method, would you please tell more details?
Now I'm trying to use the last solution and see if it is acceptable.

Thanks again.
Leon

2010/11/5 David Duncan david.dun...@apple.com

 On Nov 2, 2010, at 8:13 PM, Leon Qiao wrote:

  I got some problems on showing a frame-by-frame animations. I use some
 png
  files in quite a big size(1024* 768). The frame rate I required is near
  1/24.

 Consider that at the framerate you desire, this will require
 1024*768*4*24=72MB of memory per second. You will almost certainly need to
 rethink your strategy.

  Is there any way to solve this problem?


 There are many, which one is appropriate will require a lot more
 information about what your animation is. Generally:
 1) Make it a movie instead
 2) Break the animation into static and animated bits, stuff them into
 views, move the views.
 3) Shrink your image sizes, scale them up for animation. 512x384 for
 example cuts the memory usage by 75%.
 --
 David Duncan




-- 
Best regards
Leon
___

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


iPad frame-by-frame animation

2010-11-03 Thread Leon Qiao
Hi everyone,

I got some problems on showing a frame-by-frame animations. I use some png
files in quite a big size(1024* 768). The frame rate I required is near
1/24.

I used to put all the images in one file, and then load a atlas texture. But
the loading action still need more time when the image size grows bigger.

Is there any way to solve this problem?

-- 
Best regards
Leon
___

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