Surely, lots of people knows the convenience of leverage UITableView to generate dynamic cell, that's the default setting of UITableView for cell.
But something you maybe fine it's another "hidden" magic is "static cell".
So, what we can get from the static cell ?
Simply like a Sign In or Sign Up page. table handling the row format for you and scrollable for you.
you just put cell and use, avoiding datasource or delegate settings in UITableViewController, for it's static, so just drag it to nib file and use, that's all.
no need "grouped" in order to show just the number of rows you want, for static cell it won't show more useless line, you even can hide the separate line easily, good one right?
Friday, April 22, 2016
Wednesday, April 20, 2016
Serverless, the future
Recently I've fallen in love with AWS.
So powerful and keeping bring new things. The serverless concept is so great and shows lots of new future.
After days struggling, I notice maybe serverless guys forget to provide a user pool for sign in or sign up function to work with cognito. but finally I found they have a beta version for that already LoL.
http://docs.aws.amazon.com/cognito/latest/developerguide/setting-up-cognito-user-identity-pools.html
after they provide "authentication" servers, serverless are more perfect and easy to became want to be AWS's "slave"
So powerful and keeping bring new things. The serverless concept is so great and shows lots of new future.
After days struggling, I notice maybe serverless guys forget to provide a user pool for sign in or sign up function to work with cognito. but finally I found they have a beta version for that already LoL.
http://docs.aws.amazon.com/cognito/latest/developerguide/setting-up-cognito-user-identity-pools.html
after they provide "authentication" servers, serverless are more perfect and easy to became want to be AWS's "slave"
Leverage AWS Mobile Hub to create backend services in fly
Personally, I'm a lazy nerd, So Mobile hub let me jump up.
But when start to deal with this Great guy, I can feel lots of inconvenient.
Unknow is the most thing scale developer special nerd.
So, finally I have a decision and direction of how to leverage the powerful mobile hub to help me but in my way.
1, can be use to build demo or sample
2, can be use to config backend services
3, to peek the great guys behind mobile hub to learn how to deal with swift projects :)
But when start to deal with this Great guy, I can feel lots of inconvenient.
Unknow is the most thing scale developer special nerd.
So, finally I have a decision and direction of how to leverage the powerful mobile hub to help me but in my way.
1, can be use to build demo or sample
2, can be use to config backend services
3, to peek the great guys behind mobile hub to learn how to deal with swift projects :)
Sunday, April 17, 2016
AWS Mobile Hub - Rename project issue
Recently, I'm trying AWS Mobile Hub to "click-to-create-app". It's amazing, as a sample or quick start, definitely should consider it.
But, what's the next? You're going to start your own one, like me. Then I occur something boring, to rename the project.
also AWS also share a link from Apple of how to rename project, but Mobile Hub has something more need to be handled. Personally, After I fixed my project, I feel maybe Mobile Hub guys need to improve their way.
I'm sharing my issues and how I work through them here. Any better ideas are welcome.
0, I try to add my "project name" as Mobile Hub prompt me, but just to me MySampleProject project when I download, I think that's not good enough. Giving me the exact project name as I specify "project name" is perfect I think.
1, Rename as Apple recommend, and also the bundle ID
https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/RenamingaProject/RenamingaProject.html
2, But that's far not enough for developer to start their own one, for we're very "straight" sometimes. There are still too much "MySampleApp" existing in this project and that's unacceptable even you can run it already. Code need to be beautiful enough so we can have a good mood :)
3, So, Rename the physical folder name to "xxx" (e.g.), and open .proj file and remove the "MySampleApp" and add your need folder name. (for after you rename the physical folder, reference are broken, so you need to delete the old one and add the new one)
4, Do a search of "MySampleApp", and fix the search framework path etc.
5, Go to build phrases, to check script and embedded frameworks to fix them
6, This part is not that obvious to notice until your run and your app crashed. The sample project enabled the "module" function, and this remain the old "MySampleApp" as module name for each controller and some cells, so you need to open storyboard and check every controller and cells or others to remove the module name. (enable module is maybe not a good way, hope Mobile Hub guys and have a better or improved solutions)
Finally, you got there, run and no crash, everything is fine.
Good Luck!
But, what's the next? You're going to start your own one, like me. Then I occur something boring, to rename the project.
also AWS also share a link from Apple of how to rename project, but Mobile Hub has something more need to be handled. Personally, After I fixed my project, I feel maybe Mobile Hub guys need to improve their way.
I'm sharing my issues and how I work through them here. Any better ideas are welcome.
0, I try to add my "project name" as Mobile Hub prompt me, but just to me MySampleProject project when I download, I think that's not good enough. Giving me the exact project name as I specify "project name" is perfect I think.
1, Rename as Apple recommend, and also the bundle ID
https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/RenamingaProject/RenamingaProject.html
2, But that's far not enough for developer to start their own one, for we're very "straight" sometimes. There are still too much "MySampleApp" existing in this project and that's unacceptable even you can run it already. Code need to be beautiful enough so we can have a good mood :)
3, So, Rename the physical folder name to "xxx" (e.g.), and open .proj file and remove the "MySampleApp" and add your need folder name. (for after you rename the physical folder, reference are broken, so you need to delete the old one and add the new one)
4, Do a search of "MySampleApp", and fix the search framework path etc.
5, Go to build phrases, to check script and embedded frameworks to fix them
6, This part is not that obvious to notice until your run and your app crashed. The sample project enabled the "module" function, and this remain the old "MySampleApp" as module name for each controller and some cells, so you need to open storyboard and check every controller and cells or others to remove the module name. (enable module is maybe not a good way, hope Mobile Hub guys and have a better or improved solutions)
Finally, you got there, run and no crash, everything is fine.
Good Luck!
Tuesday, April 5, 2016
Parse vs. AWS (Mobile Hub), The Decision
Knowing Parse is going down, surprising me somehow but not surprising me somehow.
I'm a Parse fan, free resource let me fell in love with Parse.
After a period of "high speed" growth of Parse, and then I can feel Parse are changing to be silence.
High speed is a good thing, but expanding horizontal too much wide to lose its way and focus.
cloud code is a great thing, but I can say it's so difficult to use. Maybe they can put 50% effort on this then can save not be like now.
After struggling again and again, finally I decide to move to AWS. I've tried China's Aliyun Cloud Service, too. But After I paid my money for a instance for Aliyun and get into the management, I decided to give up and continue to use AWS in seconds. Maybe Aliyun is still on its way of growing or maybe AWS are just too powerful to be compared with.
Anyway, The decision is made, moving to AWS
I'm a Parse fan, free resource let me fell in love with Parse.
After a period of "high speed" growth of Parse, and then I can feel Parse are changing to be silence.
High speed is a good thing, but expanding horizontal too much wide to lose its way and focus.
cloud code is a great thing, but I can say it's so difficult to use. Maybe they can put 50% effort on this then can save not be like now.
After struggling again and again, finally I decide to move to AWS. I've tried China's Aliyun Cloud Service, too. But After I paid my money for a instance for Aliyun and get into the management, I decided to give up and continue to use AWS in seconds. Maybe Aliyun is still on its way of growing or maybe AWS are just too powerful to be compared with.
Anyway, The decision is made, moving to AWS
Monday, April 4, 2016
iOS app, using Xcode to create Multiple target with localized plist file
Recently, I need to create another "free version" for my existing app like most of other people, business need.
After some struggling and researching, I found a solution but the guide are very unclear. So I think it's better to post one for myself, in case I have to struggle again and also for does are still struggling.
For you do have one existing target, let's say it's name is testapp, and now you want another one, according apple develop center's doc I believe you can find something more useful than I descripte it here, so I will just skip "duplication and rename the build target" part.
roughly steps:
1, in Xcode, duplicate your build target
2, rename your build target
3, rename your xxx-Info.plist file to what you want, in my case I use testapp-free-Info.plist
4, go to "Build Setting" to rename the plist reference, so that you can view your plist while click the "Info" tab.
let's continue to create localizing file for our new build target
5, add a new .strings file and name it to "InfoPlist.strings". ( One thing I still double if could I rename this, I only can success when using the default name. if anyone know how to use a custom name for multiple targets, please share your great tricks :))
6, So, make sure you add a new .strings with the name "InfoPlist.strings" and put it to different location of your old target, for both targets new using the same localized file name.
7, Then the left is sample as usual, just localized your .strings file.
After some struggling and researching, I found a solution but the guide are very unclear. So I think it's better to post one for myself, in case I have to struggle again and also for does are still struggling.
For you do have one existing target, let's say it's name is testapp, and now you want another one, according apple develop center's doc I believe you can find something more useful than I descripte it here, so I will just skip "duplication and rename the build target" part.
roughly steps:
1, in Xcode, duplicate your build target
2, rename your build target
3, rename your xxx-Info.plist file to what you want, in my case I use testapp-free-Info.plist
4, go to "Build Setting" to rename the plist reference, so that you can view your plist while click the "Info" tab.
let's continue to create localizing file for our new build target
5, add a new .strings file and name it to "InfoPlist.strings". ( One thing I still double if could I rename this, I only can success when using the default name. if anyone know how to use a custom name for multiple targets, please share your great tricks :))
6, So, make sure you add a new .strings with the name "InfoPlist.strings" and put it to different location of your old target, for both targets new using the same localized file name.
7, Then the left is sample as usual, just localized your .strings file.
Saturday, April 2, 2016
About UITableViewController
Everytime when you have your tableView grouped, you will see some margin on the top of the table, I'm not quite sure yet, but I think that's the headerView of the tableView.
So, after I set a UIView to tableView's headerView, then the margin was gone or as the height as I want.
something like this
Simple and Nice.
So, after I set a UIView to tableView's headerView, then the margin was gone or as the height as I want.
something like this
self.tableView.tableHeaderView = UIView(frame: CGRectMake(0,0,self.tableView.frame.width,1))Simple and Nice.
About UICollectionViewController
Recently, I tried to use a UICollectionViewController to show some buttons, I thought it shouldn't be difficult, for I heard lots of people said it's very similar to UITableViewController, and one thing let me struggling a little long.
A good way to show buttons in a nice layout. It turns out the UICollectionViewController's layout has some default values for some properties.
let layout = self.collectionViewLayout as! UICollectionViewFlowLayout
layout.sectionInset = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
layout.itemSize = CGSizeMake((self.view.frame.width-8)/3,(self.view.frame.width-8)/3)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 2
if you don't want any margin for your cell, you need to override below two properties, for the default value is 10.
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
A good way to show buttons in a nice layout. It turns out the UICollectionViewController's layout has some default values for some properties.
let layout = self.collectionViewLayout as! UICollectionViewFlowLayout
layout.sectionInset = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
layout.itemSize = CGSizeMake((self.view.frame.width-8)/3,(self.view.frame.width-8)/3)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 2
if you don't want any margin for your cell, you need to override below two properties, for the default value is 10.
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
Subscribe to:
Posts (Atom)