I am writing iOS application for iPad that require custom layout.

The layout from portrait and landscape are totally difference, so it can't be solve by using UIAutoResizingMask.

I try to use the layoutSubview Method, but I detected that layout subview is called a lot (from UIScrollView).
How can i reduce the layoutSubview call to optimize the code , or I should call it by my self when ever the device is rotated. 

Thank.


Question: Is it ethical to profit by having my students buy my textbook?
Answer: This is an interesting question but it involves much more than just ethics and financial considerations. It is also a matter of tradition versus more modern thinking about free material.

I am currently writing a custom "book" (not to be published anytime soon) for a new course since no existing book will fit. It will be free of charge, as developmental material, until it becomes published (which will happen if I think it is any good in the end). My old advisor used his lecture notes developed over years to produce a commercial book that can be used by many but is tailored to his (in this case) course. To write materials for your own course or on your research field is quite natural. For obvious reasons such books will suit their purpose best.

I think many would dream of having tailored reading materials in their courses; few have the opportunity to spend the time writing it. In many, if not most, university systems no-one will pay you for writing it so it will be done on your free time. Such books benefit the students by covering more or less exactly what the course is about. As teachers, we have probably been involved in (endless) discussions about the pros and cons of books: "this covers this material, that book covers that, but not none is perfect. So which one to chose.". The small amount of royalty from own students is not enough to make anyone rich. From this perspective, and assuming the book (and the course) is any good, I think making the issue a matter of ethics is petty. 

The choice is obviously to provide a book material as, for example, free pdf material or try to have it printed (which is expensive) as a regular book or as print on demand. If one want others to use the material, publishing a book puts the material "on the map". A book also carries with it prestige, not only for the author but for the department and the university. It may also signal to the student that the teacher is a "name" in the field. So there are many reasons for choosing a book but not many will first look at it as a source for revenue.

So in the end, I cannot see anything wrong with using a book and receiving royalty as long as the book is good, the course is good, so that the students get the best opportunity to learn the material the course should provide.