We study the solvent-annealing-induced nanowetting in templates using porous anodic aluminum oxide membranes. The morphology of polystyrene and poly(methyl methacrylate) nanostructures can be controlled, depending on whether the swollen polymers are in the partial or complete wetting regimes, which are characterized by the spreading coefficient. When the swollen polymers are in the partial wetting regime, polymers wet the nanopores by capillary action, resulting in the formation of polymer nanorods. When the swollen polymers are in the complete wetting regime, polymers form wetting layers in the nanopores, resulting in the formation of polymer nanotubes. The solubility parameters of polymers and solvents are also used to predict the wetting behavior of swollen polymers in cylindrical geometry.